plot_boundary {BoundaryStats} | R Documentation |
Map the boundary elements of two raster layers
Description
This is a wrapper function for ggplot2 that will produce a map of boundary elements for two traits and show where boundary elements intersect.
Usage
plot_boundary(x, y, color = NA, trait_names = NA, output_raster = FALSE)
Arguments
x |
A SpatRaster object with boundary elements. |
y |
A SpatRaster object with boundary elements. |
color |
Optional. A character vector of up to three colors (x boundary, y boundary, and overlapping elements). |
trait_names |
Optional. A character vector with up to two elements (legend name for x and legend name for y). |
output_raster |
Returns a SpatRaster object with the boundary elements of each trait and overlapping boundary elements together in a single layer. |
Value
A ggplot2 object.
Author(s)
Amy Luo
Examples
data(T.cristatus)
T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs)
terra::ext(T.cristatus) <- T.cristatus_ext
data(grassland)
grassland <- terra::rast(grassland_matrix, crs = grassland_crs)
terra::ext(grassland) <- grassland_ext
Tcrist_boundaries <- define_boundary(T.cristatus, cat = TRUE)
grassland_boundaries <- define_boundary(grassland, threshold = 0.1)
plot_boundary(Tcrist_boundaries, grassland_boundaries)
[Package BoundaryStats version 2.3.0 Index]