R/studyAreaPlotting.R
plotChangeOverTime.RdSubtracts 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"
)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.
Names (or, if missing, first/last) of the layers to subtract.
result = x[[to]] - x[[from]].
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").
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).
Short prefix for the per-layer GeoTIFF filename.
Where to place the legend on the map.
One of "bottomright" (default), "bottomleft", "topright", "topleft".
A leaflet htmlwidget showing the difference layer with a
symmetric (zero-centred) colour scale. Static-safe.
plotTimeSeriesLeaflet() for the time-step viewer that
complements this difference view.