Site icon R-bloggers

More cartograms of New Zealand census data (district and city level)!

[This article was first published on Peter's stats stuff - R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Just a short note to say that I’ve finished creating an experimental map of New Zealand by the 66 Territorial Authorities (districts and cities), with area expanded or shrunk to be proportional to population at the 2013 census. This is in addition to the 16 Regional Council divisions I blogged about a couple of days ago. It’s available in the nzcensus R package.

So some static plots:

And an enhanced Shiny web-app:

Code for producing the static images:

# Latest version of nzcensus package:
devtools::install_github("ellisp/nzelect/pkg2")

library(nzcensus)
library(tidyverse)
library(viridis)

# we need make_legend() and colour_scale() as defined in
# http://ellisp.github.io/blog/2017/04/23/cartograms

comb_data_ta <- ta_cart@data %>%
   left_join(TA2013, by = c("Name" = "TA2013_NAM")) %>%
   as_tibble()

par(.main= 1, fg = "grey75")
plot(ta_cart,
     col = colour_scale(comb_data_ta$PropNoQualification2013))
title(main = "People with no qualification; areas sized by usual resident population")
make_legend(comb_data_ta$PropNoQualification2013, 
            title = "Percentage of all individuals\nwith no qualification",
            location = "left", cex = 0.8)

par(.main= 1, fg = "grey75")
plot(ta_cart,
     col = colour_scale(comb_data_ta$PropLabourers2013))
title(main = "Labourers as a percentage of those with occupation;\nareas sized by usual resident population")
make_legend(comb_data_ta$PropLabourers2013, 
            title = "Percentage of all individuals\nwho are labourers",
            location = "left", cex = 0.8)

Also available for the Shiny app:

To leave a comment for the author, please follow the link and comment on their blog: Peter's stats stuff - R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.