View source: R/visualizations.R
| rasterComp | R Documentation | 
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,
  ...
)
| rast1 | A single  | 
| rast2 | A single  | 
| col1 | Color for  | 
| col2 | Color for  | 
| rast1Name | An optional name for the first set
of occurrences, which will be color-coded to
 | 
| rast2Name | An optional name for the first set
of occurrences, which will be color-coded to
 | 
| land | An optional coastline polygon shapefile
of types  | 
| landCol | Color for land on map. | 
| title | A title for the plot. | 
| graticule | Do you want a grid of lon/lat lines? | 
| ... | Additional optional arguments to pass to
 | 
A plot of class recordedplot overlaying mapped,
semitransparent extents of the input rasters
The extents of rast1 and rast2
must match.
plot
library(terra)
rast1 <- rast(ncol=10, nrow=10)
values(rast1) <- rep(0:1, 50)
rast2 <- rast(ncol=10, nrow=10)
values(rast2) <- c(rep(0, 50), rep(1,50))
rasterComp(rast1 = rast1, rast2 = rast2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.