cv: a blockCV cv_* object; a cv_spatial, cv_cluster, cv_buffer
or cv_nndm
x: a simple features (sf) or SpatialPoints object of the spatial sample data used for creating the cv object. This could be empty when cv is a cv_spatial object.
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. 1:3 or c(2, 7, 16, 22)
max_pixels: integer; maximum number of pixels used for plotting r
remove_na: logical; whether to remove excluded points in cv_buffer from the plot
raster_colors: character; a character vector of colours for raster background e.g. terrain.colors(20)
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 cv_spatial object is used.
Returns
a ggplot object
Examples
library(blockCV)# import presence-absence species datapoints <- read.csv(system.file("extdata/","species.csv", package ="blockCV"))pa_data <- sf::st_as_sf(points, coords = c("x","y"), crs =7845)# spatial clusteringsc <- cv_cluster(x = pa_data, k =5)# now plot the create foldscv_plot(cv = sc, x = pa_data,# sample points nrow =2, points_alpha =0.5)