簡體   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