| choropleth | R Documentation |
Creates a choropleth map from an 'sf' object containing
polygon-level reporting values, for example one produced by
summarise_points_by_polygon(). Polygons are shaded according to values
in a specified column, with clustering based on the Fisher–Jenks algorithm.
choropleth(
data,
value = "output",
id = NULL,
mode = c("plot", "view"),
n = 7,
legend_title = "Value",
palette = "viridis",
id_name = NULL,
...,
basemaps = c("Esri.WorldGrayCanvas", "OpenStreetMap", "Esri.WorldImagery")
)
data |
An object of class |
value |
A string giving the name of the column used to shade the polygons. |
id |
Optional string giving the name of the column containing polygon IDs used for tooltips. |
mode |
A string indicating whether to create a static map
( |
n |
Integer; number of clusters. Default is |
legend_title |
A string giving the legend title. |
palette |
A palette name or vector of colors. See
|
id_name |
Deprecated. Use |
... |
Additional arguments passed to |
basemaps |
Character vector of basemap providers for
|
The function uses the Fisher–Jenks algorithm
(style = "fisher") to classify values into n groups.
A tmap object (static or interactive, depending on
mode).
Martin Haringa
test <- summarise_points_by_polygon(nl_provincie, insurance, "amount")
choropleth(test, value = "amount_sum")
## Not run:
choropleth(test, value = "amount_sum", id = "areaname", mode = "view")
choropleth(test, value = "amount_sum", mode = "view",
basemaps = "Esri.WorldImagery")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.