Skip to contents

# Wrapper around `tmap::tm_polygons()` with sane defaults for plotting indicator values

Source: `R/map.R`
`add_indicator_layer.Rd`

Wrapper around `tmap::tm_polygons()` with sane defaults for plotting indicator values

## Usage

    add_indicator_layer(
      poly,
      col,
      buffer = NULL,
      n = 5,
      style = "pretty",
      palette = pal_reach("red_5"),
      as_count = TRUE,
      color_na = cols_reach("white"),
      text_na = "Missing data",
      legend_title = "Proportion (%)",
      legend_text_separator = " - ",
      border_alpha = 1,
      border_col = cols_reach("lt_grey_1"),
      lwd = 1,
      ...
    )

## Arguments

poly

  Multipolygon shape defined by sf package.

col

  Numeric attribute to map.

buffer

  A buffer, either one value or a vector of 4 values (left, bottom, right, top).

n

  The desire number of classes.

style

  Method to process the color scale for continuous numerical variables. See `classInt::classIntervals()` for details.

palette

  Vector of fill colors as hexadecimal values. For REACH color palettes, it is possible to use `pal_reach()`. For now,'palette' must be changed manually, accordingly to the number of drawn classes.

as_count

  Boolean. When col is a numeric variable, should it be processed as a count variable? For instance, 0, 1-10, 11-20.

color_na

  Fill color for missing data.

text_na

  Legend text for missing data.

legend_title

  Legend title.

legend_text_separator

  Text separator for classes. E.g. " to " will give 0, 1 to 10, 11 to 20.

border_alpha

  Transparency of the border.

border_col

  Color of the border.

lwd

  Linewidth of the border.

...

  Other arguments to pass to `tmap::tm_polygons()`.

## Value

A tmap layer.