This script plots a semitransparent layer of suitable habitat for each depth layer. The redder the color, the shallower the layer, the bluer, the deeper. The more saturated the color, the more layers with suitable habitat.

plotLayers(
  rast,
  land = NA,
  landCol = "black",
  title = NULL,
  graticule = TRUE,
  ...
)

Arguments

rast

A SpatRaster vector with the 3D presence/absence distribution of a species (interpreted as 1 = presence, 0 = absence).

land

An optional coastline polygon shapefile of types sf or SpatRaster to provide geographic context for the occurrence points.

landCol

Color for land on map.

title

A title for the plot. If not title is supplied, the title "Suitability from (MINIMUM DEPTH) to (MAXIMUM DEPTH)" is inferred from names of rast.

graticule

Do you want a grid of lon/lat lines?

...

Additional optional arguments.

Value

A plot of class recordedplot

Note

Only include the depth layers that you actually want to plot.

See also

Examples

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))

rast3 <- rast(ncol=10, nrow=10)
values(rast3) <- rep(c(1,0,0,1), 25)

distBrick <- c(rast1, rast2, rast3)

plotLayers(distBrick)