It seems that with function borders()
for coordinates of some states are connected together.
To solve this problem you can store state
borders as separate data frame using map_data()
and then add state
borders using geom_path()
to your map. In geom_path()
add group=region
to ensure that points are connected only according one region.
To show borders just for the Alabama counties you should add argument region="alabama"
to function borders()
.
al1 = get_map(location = c(lon = -86.304474, lat = 32.362563),
zoom = 6, maptype = 'roadmap')
mdat <- map_data('state')
ggmap(al1) +
geom_path(data=mdat,aes(x=long,y=lat,group=region),colour="red",alpha=0.8)+
borders("county", colour="blue", alpha=0.5,region="alabama")