Combining Admin 1 Choropleths and Reference Maps

January 11, 2016
By

(This article was first published on R – AriLamstein.com, and kindly contributed to R-bloggers)

A new version of choroplethr (v3.4.0) is now on CRAN. It allows you to combine Administrative Level 1 choropleths with reference maps. For reference, this functionality has been present for US maps for a while now (1, 2). This update just extends that functionality to the Administrative Level 1 mapping function, admin1_choropleth. To do this, just set the parameter reference_map=TRUE.

This feature is most useful when zooming in on small regions. In these situations it is often difficult to understand “what you are looking at” with just a choropleth. Consider this example: population density in the Kansai region of Japan. Note that I used to live in the Kansai region of Japan, so I already have some familiarity with the region:

library(choroplethr)
library(choroplethrAdmin1)

?df_japan_census
data(df_japan_census)
df_japan_census$value = df_japan_census$pop_density_km2_2010

# prefecture names for kansai region in japan
kansai = c("mie", "nara", "wakayama", "kyoto", "osaka", "hyogo", "shiga")
admin1_choropleth(country.name = "japan", 
                  df           = df_japan_census, 
                  num_colors   = 4, 
                  zoom         = kansai)

kansai-choro

I can name about half of the regions from memory, but that’s it. I expect that most of my friends wouldn’t get that far. Adding in a google maps layer helps people understand things much better:

 
admin1_choropleth(country.name = "japan", 
                  df           = df_japan_census, 
                  title        = "2010 Population DensitynKansai Region, Japan",
                  legend       = "People / km^2",
                  num_colors   = 4, 
                  zoom         = kansai,
                  reference_map = TRUE)

kansai-ref

Here you can see that the Kansai region includes famous cities such as Osaka, Kobe and Kyoto. And the choropleth helps you understand that the prefectures that contain Osaka, Kobe and Kyoto are much denser than the other prefectures in Kansai. Incidently, I used to live in Tsu, on the eastern region of Kansai. It’s one of the most rural prefectures of Kansai. My jogging route used to literally go through rice fields!

Wrapping Up

If you wind up using this package in your work, please tweet me an image of your map (@arilamstein) – I’m always interested to see how my software is being used.

If you want help getting started with this package, this vignette should help. Also, my course Mapmaking in R with Choroplethr goes into considerably more detail.

The post Combining Admin 1 Choropleths and Reference Maps appeared first on AriLamstein.com.

To leave a comment for the author, please follow the link and comment on their blog: R – AriLamstein.com.

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.

Search R-bloggers


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)