繁体   English   中英

用ggplot / ggmap绘制到shapefile区域

[英]Plotting to shapefile region with ggplot / ggmap

我有一个shapefile,显示了英格兰地图以及映射的区域:

England <- readOGR(dsn = "...")

England.fort <- fortify(England, region='regionID') 
England.fort <-England.fort[order(England.fort$order), ] 

给我England.fort:

England.fort
>long
>lat
>order
>hole
>piece
>id      #contains the region IDs
>group   #contains the region IDs
>Total   #I want to plot this

来自此处的Shapefile: https ://geoportal.statistics.gov.uk/Docs/Boundaries/Local_authority_district_(GB)_2014_Boundaries_(Generalised_Clipped).zip

我想绘制显示每个区域总人数的区域:

p <- ggplot(data=England.fort, aes(x=long, y=lat, group=group, fill="Total")) + 
     geom_polygon(colour='black', fill='white') + theme_bw()

但这给了我一张英格兰以外所有地区都是白色的空白地图。

ggplot(data=England.fort, aes(x=long, y=lat, group=group, Fill=Total)) + 
          geom_polygon() +
          theme_bw()

绝招。 谢谢

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM