The map used comes from ? in the choroplethrAdmin1 package. See ?get_admin_countries and ?get_admin_regions in the choroplethrAdmin1 package for help with the spelling of regions.

admin1_choropleth(, df, title = "", legend = "",
  num_colors = 7, zoom = NULL, reference_map = FALSE)


The name of the country. Must exactly match how the country is named in the "country" column of ?admin1.regions in the choroplethrAdmin1 package.


A data.frame with a column named "region" and a column named "value". Elements in the "region" column must exactly match how regions are named in the "region" column in ?admin1.regions in the choroplethrAdmin1 package


An optional title for the map.


An optional name for the legend.


The number of colors on the map. A value of 1 will use a continuous scale. A value in [2, 9] will use that many colors.


An optional vector of regions to zoom in on. Elements of this vector must exactly match the names of regions as they appear in the "region" column of ?admin1.regions.


If true, render the choropleth over a reference map from Google Maps.


library(choroplethrAdmin1) data(df_japan_census) head(df_japan_census)
#> region pop_2010 percent_pop_change_2005_2010 pop_density_km2_2010 #> 23 aichi 7411000 2.2 1434.8 #> 5 akita 1086000 -5.2 93.3 #> 2 aomori 1373000 -4.4 142.4 #> 12 chiba 6216000 2.6 1205.5 #> 38 ehime 1431000 -2.5 252.1 #> 18 fukui 806000 -1.9 192.4
# set the value we want to map to be the 2010 population estimates df_japan_census$value=df_japan_census$pop_2010 # default map of all of japan admin1_choropleth("japan", df_japan_census, "2010 Japan Population Estimates", "Population")
# zoom in on the Kansai region and use a continuous scale kansai = c("mie", "nara", "wakayama", "kyoto", "osaka", "hyogo", "shiga") admin1_choropleth("japan", df_japan_census, "2010 Japan Population Estimates", "Population", 1, kansai)
admin1_choropleth("japan", df_japan_census, "2010 Japan Population Estimates", "Population", 1, kansai, reference_map = TRUE)
#> Error: Google now requires an API key. #> See ?register_google for details.