I have a data frame such that each row contains location data (latitude and longitude) and categorical integer numeric values ranging from 1-4.
Something like this, but with more meaningful lat/lon values:
id | lat | lon | cluster
---- | ---- | ---- | -------
1 | 12 | -32 | 3
2 | 15 | -36 | 1
3 | 16 | -37 | 3
4 | 11 | -37 | 1
I have plotted the points on a map, but I want to be able to specify the colors of the points. Can I specify, for example, that points belonging to cluster 1 appear red, points belonging to cluster 2 appear orange, points belonging to cluster 3 appear green, etc.?
m<-get_map(location=c(lon=0, lat=0), zoom=1)
ggmap(m, extent = "normal") + geom_point(aes(x = lon, y = lat, color = cluster), data = df)
I assume there's something I need to add to the aes() function of ggmap, but I can't figure it out.
Thanks!