I am creating several maps, and I would like to show the boundaries of the counties on top of the roadmap ggmap
. Here is an example of using parts of Texas.
library(ggmap)
map = get_map(location = c(-95.31619, 28.42460),
zoom = 6, source = "google", maptype="roadmap")
map.plot = ggmap(map)
counties <- map_data("county")
tx_county <- subset(counties, region == 'texas')
map.plot +
theme_nothing() +
geom_polygon(data = tx_county, aes(x=long, y=lat), fill = NA, color = "red")
However, the resulting figure has lines crossing counties, not just borders.

Any thoughts on what I'm doing wrong? I saw another example here where it works when used only ggplot2
, but I would like to use the roadmap from ggmap
.
source
share