Combining Admin 1 Choropleths and Reference Maps

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:

[code lang=”r” collapse=”true”]
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)
[/code]

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:

[code lang=”r” collapse=”true”]
admin1_choropleth(country.name = "japan",
df = df_japan_census,
title = "2010 Population Density\nKansai Region, Japan",
legend = "People / km^2",
num_colors = 4,
zoom = kansai,
reference_map = TRUE)
[/code]

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.