Description Usage Arguments Examples
The map used is country.map in the choroplethrMaps package. See country.regions for an object which can help you coerce your regions into the required format.
1 2 | country_choropleth(df, title = "", legend = "", buckets = 7,
zoom = NULL)
|
df |
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 ?country.map. |
title |
An optional title for the map. |
legend |
An optional name for the legend. |
buckets |
The number of equally sized buckets to places the values in. A value of 1 will use a continuous scale, and a value in [2, 9] will use that many buckets. |
zoom |
An optional vector of countries to zoom in on. Elements of this vector must exactly match the names of countries as they appear in the "region" column of ?country.regions |
1 2 3 4 5 6 7 8 9 10 11 12 | # demonstrate default options
data(df_pop_country)
country_choropleth(df_pop_country, "2012 World Bank Populate Estimates")
# demonstrate continuous scale
country_choropleth(df_pop_country, "2012 World Bank Populate Estimates", buckets=1)
# demonstrate zooming
country_choropleth(df_pop_country,
"2012 World Bank Population Estimates",
buckets=1,
zoom=c("united states of america", "canada", "mexico"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.