ggmap Overlay shapefile with filled polygon of regions
city = readShapePoly("/home/xuefliang/RInMedicine/city/city_region.shp")
gpclibPermit() #install.packages("gpclib", type = "source")
tract <- fortify(city,region="CNTY_CODE")
gansu <- get_map(location = 'gansu', zoom = 5,maptype = 'roadmap')
ggmap(gansu)+
geom_polygon(data = tract, aes(x = long, y = lat, group = group), colour = "black",fill='grey' ,alpha = 0.2) +
theme_nothing(legend = TRUE)+
coord_cartesian(xlim=c(90, 110), ylim=c(32, 43))
gpclibPermit() #install.packages("gpclib", type = "source")
tract <- fortify(city,region="CNTY_CODE")
gansu <- get_map(location = 'gansu', zoom = 5,maptype = 'roadmap')
ggmap(gansu)+
geom_polygon(data = tract, aes(x = long, y = lat, group = group), colour = "black",fill='grey' ,alpha = 0.2) +
theme_nothing(legend = TRUE)+
coord_cartesian(xlim=c(90, 110), ylim=c(32, 43))
评论
发表评论