Plot Position of Sites in Environmental Space
Source:R/fb_plot_site_environment.R
fb_plot_site_environment.Rd
Plot a figure showing the average environmental space of given sites compared to a full environmental vector. For the sake of simplicity only represents the figure along two environmental axes. The average environmental value are extracted for each site.
Arguments
- site_locations
an
sf
object with the spatial geometries of sites. NOTE: the first column should be named"site"
and indicate site names.- environment_raster
a
SpatRaster
object (packageterra
). A single or multi-layers environmental raster.- first_layer
character(1)
the name of the first layer to use, by default uses the first layer ofenvironment_raster
- second_layer
character(1)
the name of the second layer to use, by default uses the second layer ofenvironment_raster
Examples
data("site_locations")
# Import climate rasters
prec <- system.file("extdata", "annual_tot_prec.tif", package = "funbiogeo")
tavg <- system.file("extdata", "annual_mean_temp.tif", package = "funbiogeo")
layers <- terra::rast(c(tavg, prec))
# Make plot (show environmental position of 6 first sites)
fb_plot_site_environment(head(site_locations), layers)
#> Warning: Removed 49503 rows containing missing values or values outside the scale range
#> (`geom_point()`).