0

I have created a ggmap with points sized and color coded by "count". Therefore, the legend displays "count" as the title when I would like it to be "Visitors". Here is the code:

ggmap(sites_map) +
  labs(x = "Longitude", y = "Latitude", title = "Home Location of Paying Visitors from Kansas") +
  coord_cartesian(xlim = c(-94, -102), ylim = c(36.9, 39.8)) +
  geom_point(data = sites, aes(x = longitude, y = latitude, colour= count), alpha = 0.7, size= sites$count) +
  scale_color_gradient2(low="green", mid="yellow", high="red", midpoint=15,
                        breaks=c(1,10,20,max(sites$count)), labels=c("1", "10", "20", "30")) +
  theme(text=element_text(size=15)) +
  geom_point(data = sites, colour = "blue", alpha = 0.5, mapping = aes(x = long, y = lat), size = sites$count, shape = 13) +
  ggsave("kansascolormap.png")

I'm new to coding, so I know it's messy! Here is the current map generated, linked below: image of map

Maridee Weber
  • 231
  • 1
  • 8
  • 2
    Does this answer your question? [How to change legend title in ggplot](https://stackoverflow.com/questions/14622421/how-to-change-legend-title-in-ggplot) – Sarah Dec 11 '19 at 02:33
  • 1
    Add `labs(color = "Visitors")`, the same as you've set other labels – camille Dec 11 '19 at 03:53

0 Answers0