Plots each column of the descriptor table returned by
lets.envcells
back onto the environmental richness raster
embedded in the envPAM object. Rows with zero frequency are masked as NA
.
Usage
lets.plot.envcells(
x,
y,
ras = FALSE,
plot_ras = TRUE,
mfrow = c(4, 4),
which.plot = NULL,
col_func = NULL
)
Arguments
- x
The envPAM list returned by
lets.envpam
(must include$Env_Richness_Raster
and$Presence_and_Absence_Matrix_env
).- y
A
data.frame
returned bylets.envcells
with one row per environmental cell (aligned withx
).- ras
Logical; if
TRUE
, returns a named list of terra SpatRaster layers corresponding to each column plotted. DefaultFALSE
.- plot_ras
Logical; if
TRUE
, the function plot the graphs. DefaultTRUE
.- mfrow
A vector of the form c(nr, nc). The figures will be drawn in an nr-by-nc array on the device by rows as in par documentation.
- which.plot
Indicate the number of the columns in y to be ploted.
- col_func
A custom color ramp palette function to use for plotting variables (e.g., from
colorRampPalette
).
Value
Invisibly returns NULL
. If ras = TRUE
, returns a named list of
SpatRaster objects corresponding to each descriptor column.
Details
Plot environmental descriptors over the environmental raster grid
Each descriptor column is assigned as values of the environmental raster template
and plotted sequentially. The plotting grid defaults to par(mfrow = c(4,4))
.
Examples
if (FALSE) { # \dontrun{
data("Phyllomedusa"); data("prec"); data("temp")
prec <- unwrap(prec); temp <- unwrap(temp)
PAM <- lets.presab(Phyllomedusa, remove.cells = FALSE)
envs <- lets.addvar(PAM, c(temp, prec), onlyvar = TRUE)
colnames(envs) <- c("Temperature", "Precipitation")
wrld_simpl <- get(utils::data("wrld_simpl", package = "letsR"))
PAM <- lets.pamcrop(PAM, terra::vect(wrld_simpl))
res <- lets.envpam(PAM, envs, n_bins = 30)
out <- lets.envcells(res, perc = 0.2)
lets.plot.envcells(res, out)
} # }