View source: R/plot_boundary.R
plot_boundary | R Documentation |
This is a wrapper function for ggplot2 that will produce a map of boundary elements for two traits and show where boundary elements intersect.
plot_boundary(x, y, color = NA, trait_names = NA, output_raster = FALSE)
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. |
A ggplot2 object.
Amy Luo
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.