I have a dataset in R with thousands of geolocalized observations and I have to plot them on a map. I managed to plot single points using this code:
originale<-read.table("file.txt", header=TRUE,sep=";")
require(ggplot2)
require(ggmap)
map <- get_map(location = c(lon=13.781693, lat=45.623124), zoom = 14, maptype = "terrain",source = "google")
p <- ggmap(map)
p_punti <- p + geom_point(data=originale, aes(x=lon, y=lat),size=5)
plot(p_punti)
Now I'd like to plot them using a set of 5-6 colours based on the number of observation located on that point. Like this one that I've created on CartoDB: https://i.stack.imgur.com/Be1DL.png
The map plotted with CartoDB is, indeed, too approximate: I need to set my own range for each colour.