I have a shapefile showing the map of England with regions mapped on it:
England <- readOGR(dsn = "...")
England.fort <- fortify(England, region='regionID')
England.fort <-England.fort[order(England.fort$order), ]
giving me 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 from here: https://geoportal.statistics.gov.uk/Docs/Boundaries/Local_authority_district_(GB)_2014_Boundaries_(Generalised_Clipped).zip
I want to plot the regions showing the total number of people in each:
p <- ggplot(data=England.fort, aes(x=long, y=lat, group=group, fill="Total")) +
geom_polygon(colour='black', fill='white') + theme_bw()
But It gives me a blank map off England with all the regions white.
ggplot(data=England.fort, aes(x=long, y=lat, group=group, Fill=Total)) +
geom_polygon() +
theme_bw()
Does the trick. Thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.