R/plot.R
plot.EnvironmentalOutlier.Rd
Display observations and potential outliers diagnosed by
function suspicious_env_outliers
in a dataset.
# S3 method for EnvironmentalOutlier
plot(x, overlay_raster = NULL, pts_alpha = 0.5, ...)
(EnvironmentalOutlier
) The PAConversion object to plot.
It could be the return of function suspicious_env_outliers
.
(RasterLayer
or stars
) The environmental raster to plot
together with points.
(numeric
) The alpha
used by geom_sf
to show points.
Not used.
A ggplot2
figure of outliers distribution among all observations.
# \donttest{
library(dplyr)
library(sf)
library(stars)
library(itsdm)
data("occ_virtual_species")
env_vars <- system.file(
'extdata/bioclim_tanzania_10min.tif',
package = 'itsdm') %>% read_stars() %>%
slice('band', c(1, 5, 12, 16))
occ_outliers <- suspicious_env_outliers(
occ = occ_virtual_species, variables = env_vars,
z_outlier = 3.5, outliers_print = 4L)
plot(occ_outliers)
plot(occ_outliers,
overlay_raster = env_vars %>% slice('band', 1))
# }