Let's assume I generate a map of London using ggmap package:
library(ggmap)
library(mapproj)
map <- get_map(location = "London", zoom = 11, maptype = "satellite")
p <- ggmap(map)+
theme(legend.position = "none")
print(p)
Now I would like to add to this plot a circle with some center coordinates(let's say: lon=-0.1, lat=52.23) and radius expressed e.g. in kilometers. I tried to use a solution from similar question(Draw a circle with ggplot2), where you can just add to the function a statement like this:
p <- p + annotate("path",
x = xc+r*cos(seq(0,2*pi,length.out=100)),
y = yc+r*sin(seq(0,2*pi,length.out=100)))
It works but the circle is not really a circle due to the different scale. Is it possible to draw it correctly? Any help would be appreciated!
EDIT: I found solution (https://gis.stackexchange.com/questions/119736/ggmap-create-circle-symbol-where-radius-represents-distance-miles-or-km) that uses different package and the output is correct. Nevertheless, if anyone knows how to do it using ggmap please share it.
+ coord_equal()
to the end of your map plot? – Ulani