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

April 24, 2017
By

(This article was first published on Peter's stats stuff - R, and kindly contributed to R-bloggers)

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(font.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(font.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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)