ranges_espace generates a three dimensional comparison of distributional ranges for a species created using distinct functions of rangemap, to visualize them in environmental conditions.

ranges_espace(..., add_occurrences = TRUE, variables, do_pca = FALSE,
              max_background = 10000, occurrence_color = "blue",
              range_colors = NULL, alpha = 0.6, legend = TRUE,
              verbose = TRUE)

Arguments

...

one or more objects of class sp_range produced with any of the following functions: rangemap_buffer, rangemap_boundaries, rangemap_hull, rangemap_enm, and/or rangemap_tsa. Using up to five ranges is allowed for more precise comparisons.

add_occurrences

(logical) if TRUE, species occurrences contained in one of the sp_range objects will be plotted. Default = TRUE. If none of the objects contains occurrences this argument will be ignored.

variables

a RasterStack object of at least 3 environmental variables that will be used to represent the environmental space. If more than 3 variables are provided, the first ones will be used, unless do_pca = TRUE, in which case the 3 first principal components will be used. Projection is assumed to be WGS84 (EPSG:4326).

do_pca

(logical) whether to summarize all variables using a principal component analysis. Default = FALSE.

max_background

(numeric) maximum number of data from variables to be used for representing the environmental space. Default = 10000.

occurrence_color

color for occurrence records in environmental space.

range_colors

vector of colors for the ranges to be represented. If NULL, the default, a set of colors will be used. Since transparency is used for representing ranges in the plot, colors may look different.

alpha

(numeric) degree of opacity for plotting species ranges. Default = 0.6.

legend

(logical) if TRUE, a simple legend will be added. Default = TRUE.

verbose

(logical) whether or not to print messages about the process. Default = TRUE.

Value

A figure showing distributional ranges of a species represented in environmental space (3 dimensions).

Examples

# example data data("buffer_range", package = "rangemap") data("cxhull_range", package = "rangemap") vars <- raster::stack(system.file("extdata", "variables.tif", package = "rangemap")) names(vars) <- c("bio5", "bio6", "bio13", "bio14") ## comparison ranges_espace(buffer_range, cxhull_range, variables = vars, add_occurrences = TRUE)
#> Warning: Discarded datum WGS_1984 in Proj4 definition, #> but +towgs84= values preserved
#> Using only the three first variables
#> Getting environmental conditions inside ranges, please wait...
#> Warning: Discarded datum WGS_1984 in Proj4 definition, #> but +towgs84= values preserved
#> Warning: Discarded datum WGS_1984 in Proj4 definition, #> but +towgs84= values preserved
#> Warning: Discarded datum WGS_1984 in Proj4 definition, #> but +towgs84= values preserved
#> Warning: Discarded datum WGS_1984 in Proj4 definition, #> but +towgs84= values preserved
#> #> Creating interactive visualization...