A convenient wrapper around terra::plot
to generate formatted plots comparing two rasters.
This is used in the context of voluModel to
overlay semi-transparent distributions (coded as 1)
in two different RasterLayers.
rasterComp(
rast1 = NULL,
rast2 = NULL,
col1 = "#1b9e777F",
col2 = "#7570b37F",
rast1Name = "Set 1",
rast2Name = "Set 2",
land = NA,
landCol = "black",
title = "A Raster Comparison",
graticule = TRUE,
...
)A single SpatRaster showing the
distribution of the species corresponding to
rast1Name. Should have values of 0 (absence)
and 1 (presence). Can also be NULL.
A single SpatRaster showing the
distribution of the species corresponding to
rast2Name. Should have values of 0 (absence)
and 1 (presence). Must match the extent and
resolution of rast1. Can also be NULL.
Color for rast1 presences
Color for rast2 presences
An optional name for the first set
of occurrences, which will be color-coded to
occs1Col in the resulting plot.
An optional name for the first set
of occurrences, which will be color-coded to
occs2Col in the resulting plot.
An optional coastline polygon shapefile
of types sf or SpatRaster to provide geographic
context for the occurrence points.
Color for land on map.
A title for the plot.
Do you want a grid of lon/lat lines?
Additional optional arguments to pass to
terra::plot().
A plot of class recordedplot overlaying mapped,
semitransparent extents of the input rasters
The extents of rast1 and rast2
must match.