Subtracts the from layer from the to layer and plots the result on a single-layer leaflet map with a diverging palette centred on zero. The "change from start to finish" view that pairs with plotTimeSeriesLeaflet().

plotChangeOverTime(
  x,
  from = NULL,
  to = NULL,
  palette = "differences",
  rev = TRUE,
  layerName = "change",
  legendPosition = "bottomright"
)

Arguments

x

One of: a multi-layer SpatRaster, a list of single-layer SpatRasters, a simList (reads <name>*.tif from SpaDES.core::outputPath(x)), or a length-1 character directory path.

from, to

Names (or, if missing, first/last) of the layers to subtract. result = x[[to]] - x[[from]].

palette

Palette name. Default "differences" – the dedicated blue->white->red diverging palette from terra::map.pal(), purpose-built for difference maps. Any other terra::map.pal() name (e.g. "viridis") is also accepted; if terra::map.pal() doesn't recognise the name, we fall back to grDevices::hcl.colors() (e.g. "RdBu", "Spectral").

rev

Reverse the palette? Default TRUE – with the "differences" palette this gives red = negative, blue = positive. Set FALSE to flip (the terra::map.pal("differences") native orientation: red = positive, blue = negative).

layerName

Short prefix for the per-layer GeoTIFF filename.

legendPosition

Where to place the legend on the map. One of "bottomright" (default), "bottomleft", "topright", "topleft".

Value

A leaflet htmlwidget showing the difference layer with a symmetric (zero-centred) colour scale. Static-safe.

See also

plotTimeSeriesLeaflet() for the time-step viewer that complements this difference view.