【发布时间】:2016-01-14 19:48:58
【问题描述】:
我有一个显示英格兰地图的 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
我想绘制显示每个区域总人数的区域:
p <- ggplot(data=England.fort, aes(x=long, y=lat, group=group, fill="Total")) +
geom_polygon(colour='black', fill='white') + theme_bw()
但它给了我一张英格兰以外的空白地图,所有地区都是白色的。
【问题讨论】:
-
我尝试了 fortify 命令,它创建了一个没有引用回区域 ID (LAD14D) 的数据框,所以我无法将总数链接到它
-
其实我认为这个链接可以解决你提到的问题!
-
不知道该说什么:)..但你可以删除 scale_fill_brewer("Total") 来测试你的其余代码
-
您可以尝试为未来的读者发布答案