cv_plot | R Documentation |
This function visualises the folds create by blockCV. It also accepts a raster layer to be used as background in the output plot.
cv_plot(
cv,
x,
r = NULL,
nrow = NULL,
ncol = NULL,
num_plots = 1:10,
max_pixels = 3e+05,
remove_na = TRUE,
raster_colors = gray.colors(10, alpha = 1),
points_colors = c("#E69F00", "#56B4E9"),
points_alpha = 0.7,
label_size = 4
)
cv |
a blockCV cv_* object; a |
x |
a simple features (sf) or SpatialPoints object of the spatial sample data used for creating
the |
r |
a terra SpatRaster object (optional). If provided, it will be used as background of the plots. It also supports stars, raster, or path to a raster file on disk. |
nrow |
integer; number of rows for facet plot |
ncol |
integer; number of columns for facet plot |
num_plots |
a vector of indices of folds; by default the first 10 are shown (if available).
You can choose any of the folds to be shown e.g. |
max_pixels |
integer; maximum number of pixels used for plotting |
remove_na |
logical; whether to remove excluded points in |
raster_colors |
character; a character vector of colours for raster background e.g. |
points_colors |
character; two colours to be used for train and test points |
points_alpha |
numeric; the opacity of points |
label_size |
integer; size of fold labels when a |
a ggplot object
library(blockCV)
# import presence-absence species data
points <- read.csv(system.file("extdata/", "species.csv", package = "blockCV"))
pa_data <- sf::st_as_sf(points, coords = c("x", "y"), crs = 7845)
# spatial clustering
sc <- cv_cluster(x = pa_data, k = 5)
# now plot the create folds
cv_plot(cv = sc,
x = pa_data, # sample points
nrow = 2,
points_alpha = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.