Learn R Programming

biomod2 (version 4.2-5)

plot,BIOMOD.formated.data,missing-method: plot method for BIOMOD.formated.data object class

Description

Plot the spatial distribution of presences, absences and pseudo-absences among the different potential dataset (calibration, validation and evaluation). Available only if coordinates were given to BIOMOD_FormatingData.

Usage

# S4 method for BIOMOD.formated.data,missing
plot(
  x,
  calib.lines = NULL,
  plot.type,
  plot.output,
  PA,
  run,
  plot.eval,
  point.size = 1.5,
  do.plot = TRUE
)

Value

a list with the data used to generate the plot and a ggplot2 object

Arguments

x

a BIOMOD.formated.data or BIOMOD.formated.data.PA object. Coordinates must be available to be able to use plot.

calib.lines

(optional, default NULL)
an data.frame object returned by get_calib_lines or bm_CrossValidation functions, to explore the distribution of calibration and validation datasets

plot.type

a character, either 'points' (default) or 'raster' (if environmental variables were given as a raster). With plot.type = 'points' occurrences will be represented as points (better when using fine-grained data). With plot.type = 'raster' occurrences will be represented as a raster (better when using coarse-grained data)

plot.output

a character, either 'facet' (default) or 'list'. plot.output determines whether plots are returned as a single facet with all plots or a list of individual plots (better when there are numerous graphics)

PA

(optional, default 'all')
If x is a BIOMOD.formated.data.PA object, a vector containing pseudo-absence set to be represented

run

(optional, default 'all')
If calib.lines provided, a vector containing repetition set to be represented

plot.eval

(optional, default TRUE)
A logical defining whether evaluation data should be added to the plot or not

point.size

a numeric to adjust the size of points when plot.type = 'points'.

do.plot

(optional, default TRUE)
A logical defining whether the plot is to be rendered or not

Author

Remi Patin

Examples

Run this code

library(terra)

# Load species occurrences (6 species available)
data(DataSpecies)
head(DataSpecies)

# Select the name of the studied species
myRespName <- 'GuloGulo'

# Get corresponding presence/absence data
myResp <- as.numeric(DataSpecies[, myRespName])

# Get corresponding XY coordinates
myRespXY <- DataSpecies[, c('X_WGS84', 'Y_WGS84')]

# Load environmental variables extracted from BIOCLIM (bio_3, bio_4, bio_7, bio_11 & bio_12)
data(bioclim_current)
myExpl <- terra::rast(bioclim_current)

# \dontshow{
myExtent <- terra::ext(0,30,45,70)
myExpl <- terra::crop(myExpl, myExtent)
# }

## ----------------------------------------------------------------------- #
# Format Data with true absences
myBiomodData <- BIOMOD_FormatingData(resp.var = myResp,
                                     expl.var = myExpl,
                                     resp.xy = myRespXY,
                                     resp.name = myRespName)
myBiomodData
plot(myBiomodData)


Run the code above in your browser using DataLab