I want to plot lines (to be precise: geom_segment
element) on my ggmap
object (which is a ggplot2
object, as I understand).
I use the following code:
library(ggmap)
mapImageData <- get_map(location = c(lon = (16.8 + ( 17.2-16.8)/2),
lat = (51 + (51.2-51)/2)),
color = "color",
source = "google",
maptype = "roadmap",
zoom = 11)
ggmap(mapImageData, extent = "device", ylab = "Latitude", xlab = "Longitude") +
geom_segment(aes(x = 51, y = 16.8, xend = 51.2, yend = 17.2))
A clear map is being drawn:
but no line (from geom_segment
) is appearing. What am I doing wrong?