Convenience plotting helper for quadrat-placement workflows. Draws the sampling domain outline and a set of quadrat polygons (optionally labelled by quadrat id) using ggplot2.
Usage
plot_quadrats(
domain,
quadrats,
title = NULL,
label_ids = c("auto", "yes", "no"),
label_threshold = 40,
id_col = "quadrat_id",
show_voronoi = c("auto", "yes", "no"),
show_seeds = c("auto", "yes", "no"),
domain_colour = "#22223b",
quadrat_colour = "#22223b",
quadrat_fill = "#4a4e69",
quadrat_alpha = 0.18,
domain_linewidth = 0.7,
quadrat_linewidth = 0.6,
voronoi_linewidth = 0.5,
label_size = 3,
base_size = 12
)Arguments
- domain
An sf polygon/multipolygon object representing the sampling domain.
- quadrats
An sf polygon/multipolygon object representing quadrats. Typically returned by
place_quadrats(),place_quadrats_tiled(),place_quadrats_systematic(),place_quadrats_transect(), orplace_quadrats_voronoi().- title
Optional character scalar used as the plot title.
- label_ids
Logical or character. If
TRUE, label each quadrat using the column given byid_col. IfFALSE, do not label. If"auto"(default), labels are shown only when the number of quadrats is at mostlabel_threshold.- label_threshold
Integer. Only used when
label_ids = "auto".- id_col
Character scalar naming the quadrat id column in
quadrats. Defaults to"quadrat_id".- show_voronoi
Logical or character. If
TRUE, and thequadratsobject carries a"voronoi_cells"attribute (as returned byplace_quadrats_voronoi()withshow_voronoi = TRUE), plot those Voronoi cell boundaries underneath the quadrats. If"auto"(default), Voronoi overlays are shown only when the needed attributes are present.- show_seeds
Logical or character. If
TRUEand Voronoi overlays are enabled, also plot the Voronoi seed points if present as a"voronoi_seeds"attribute. If"auto"(default), seeds are shown when present.- domain_colour, quadrat_colour
Character scalars giving line colours for the domain outline and quadrat outlines.
- quadrat_fill
Character scalar giving the quadrat fill colour.
- quadrat_alpha
Numeric in (0,1]. Alpha transparency for quadrat fill.
- domain_linewidth, quadrat_linewidth
Numeric line widths.
- voronoi_linewidth
Numeric line width for Voronoi cell boundaries.
- label_size
Numeric text size for quadrat id labels.
- base_size
Base font size passed to
ggplot2::theme_minimal().
Examples
if (FALSE) { # \dontrun{
library(spesim)
set.seed(1)
dom <- create_sampling_domain()
qs <- place_quadrats(dom, n_quadrats = 12, quadrat_size = c(1.5, 1.5))
plot_quadrats(dom, qs, title = "Random quadrats")
} # }