My data frame looks like that:
Sho lat lon autoroute
1000001 46.20114 5.19791 0
1000002 46.21842 5.22767 1
1000004 46.18836 5.24447 0
1000006 46.20754 5.23758 1
1000007 46.20105 5.24891 0
I have the next code:
basec=read.csv("map2.csv")
map <- get_map(location = 'France', zoom = 6)
mapPoints <- ggmap(map) + geom_point(aes(x = lon, y = lat, colour=autoroute), data = basec, alpha = 0.5, size=0.8)
And the output is:
How can I change the change the colors of points depending on the route values? I've trying scale_colour_manual but I got the following error:
Error: Continuous value supplied to discrete scale
And as you can see at the top of the map of France appears slightly cut. How can I fix this?
To fix the color values change the variable to a factor:
basec$autoroute <- as.factor(basec$autoroute)
Also, you can center the map yourself. Use a different center
cntr <- c(2.645, 47.45)
map <- get_googlemap(center=cntr, zoom=6)
You can keep tweaking the center yourself if this one still crops a bit of the country.