Skip to contents

The map of the dominant source of variance in every cell, next to a stacked bar of the shares pooled over the area (and the region). Legend entries give the number and share of cells each source dominates.

Usage

plot_partition(
  x,
  type = c("both", "map", "bar"),
  max_cells = 5e+05,
  base_size = 11,
  file = NULL,
  width = NULL,
  height = NULL
)

Arguments

x

A result of partition_uncertainty().

type

"both", "map" or "bar".

max_cells

Largest number of cells drawn.

base_size

Base font size.

file

Optional file(s) to save the plot to, e.g. "fig.pdf" or c("fig.png", "fig.pdf"); the format follows the extension, and a name without extension is saved as PNG and PDF.

width, height

Size of the saved figure in pixels (default 3600 x 1650 for both panels; PDF and SVG at 300 pixels per inch).

Value

A ggplot, or for type = "both" invisibly a list of two.

References

Wilson, R.J., Kay, S., Ciavatta, S. (2024) Partitioning climate uncertainty in ecological projections: Pacific oysters in a hotter Europe. Ecological Informatics 80, 102537. doi:10.1016/j.ecoinf.2024.102537

Examples

sim <- simulate_enm_data(seed = 1)
base <- sim$models[[c("GLM", "GBM", "Maxent_LQ")]]
design <- expand.grid(algorithm = names(base), gcm = c("A", "B"),
                      stringsAsFactors = FALSE)
proj <- terra::rast(lapply(seq_len(nrow(design)), function(i) {
  terra::clamp(base[[design$algorithm[i]]] -
                 0.1 * (design$gcm[i] == "B"), 0, 1)
}))
plot_partition(partition_uncertainty(proj, design))