tmap_CreateLayer: Create a 'tmap'-style map layer from a 'sf' dataframe...

View source: R/tmap_CreateLayer.R

tmap_CreateLayerR Documentation

Create a tmap-style map layer from a sf dataframe representing a model output

Description

Function to create a tmap-style map layer from an sf dataframe representing a model output.

Usage

tmap_CreateLayer(
  sf_dfr,
  col = 4,
  n = 10,
  style = ifelse(is.null(breaks), "pretty", "fixed"),
  breaks = NULL,
  palette = c("blue", "red")
)

Arguments

sf_dfr

- sf dataset

col

- name or index of values column to plot

n

- preferred number of classes.

style

- method to process the color scale. Discrete options are "fixed", "sd", "equal", "pretty", "quantile", "kmeans", "hclust", "bclust", "fisher", "jenks", and "log10_pretty". For discrete options (except "log10_pretty"), see the details in tmap::classIntervals. Continuous options are "cont", "order", and "log10". The first maps the values of col to a smooth gradient, the second maps the order of values of col to a smooth gradient, and the third uses a logarithmic transformation.

breaks

- in case style=="fixed", breaks should be specified. The breaks argument can also be used when style="cont". In that case, the breaks are mapped evenly to the sequential or diverging color palette.

palette

- a 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 taken from tm_layout's argument aes.palette.

Details

Creates a tmap-style shape/fill combination map layer with polygons colored using the palette to represent values of the ROMS variable in sf_dfr. If not provided, the palette will default to the palette associated with the basemap used to plot the layer.

Value

A tmap-style shape/fill combination map layer with polygons colored using the palette to represent values of the ROMS variable in sf_dfr.


wStockhausen/wtsROMS documentation built on Feb. 2, 2025, 9:16 p.m.