Learn R Programming

spatialrisk (version 0.6.6)

choropleth: Create choropleth map

Description

Takes an object produced by points_to_polygon(), and creates the corresponding choropleth map.

Usage

choropleth(
  sf_object,
  value = "output",
  id_name = "areaname",
  mode = "plot",
  n = 7,
  legend_title = "Clustering",
  palette = "viridis"
)

Arguments

sf_object

object of class sf

value

column name to shade the polygons

id_name

column name of ids to plot

mode

choose between static ('plot' is default) and interactive map ('view')

n

number of clusters (default is 7)

legend_title

title of legend

palette

palette name or a vector of colors. See tmaptools::palette_explorer() for the named palettes. Use a "-" as prefix to reverse the palette. The default palette is "viridis".

Value

tmap

Examples

Run this code
# NOT RUN {
test <- points_to_polygon(nl_provincie, insurance, sum(amount, na.rm = TRUE))
choropleth(test)
choropleth(test, id_name = "areaname", mode = "view")
# }

Run the code above in your browser using DataLab