Skip to contents

Plot a climniche map

Usage

plot_climniche_map(
  x,
  metric = c("niche_distance_change", "niche_boundary_exceedance",
    "climate_change_amount", "climate_reconfiguration", "change_alignment",
    "outside_niche_exceedance", "composition_change"),
  occupied = NULL,
  occupied_only = FALSE,
  occupied_threshold = NULL,
  title = NULL,
  midpoint = 0,
  limits = NULL,
  breaks = NULL,
  colours = NULL,
  legend_title = NULL,
  legend_position = "right",
  show_legend = TRUE,
  symmetric = NULL,
  extent = NULL,
  degree_labels = c("auto", "none", "hemisphere"),
  study_region = NULL,
  region_colour = "black",
  region_linewidth = 0.35,
  region_linetype = 1
)

Arguments

x

A fitted climniche object with raster outputs, a RasterLayer, or a terra SpatRaster.

metric

Quantity to plot. Accepted values are "climate_change_amount" for Climatic Displacement, "niche_distance_change" for Niche Distance Shift, "climate_reconfiguration" for Climatic Reconfiguration, "niche_boundary_exceedance" for Niche Boundary Exceedance, and "change_alignment" for the signed ratio used internally. Legacy aliases "composition_change" and "outside_niche_exceedance" still work.

occupied

Optional current reference RasterLayer or terra SpatRaster used for masking or overlaying the current reference distribution.

occupied_only

If TRUE, mask the plotted raster to current occurrence or suitability cells with positive reference weight.

occupied_threshold

Threshold used when occupied contains binary or continuous values. Values above the threshold keep their original value when used as an overlay or mask.

title

Optional plot title. Use FALSE to suppress it.

midpoint

Midpoint for the Niche Distance Shift colour scale.

limits

Optional two-element colour scale limits.

breaks

Optional colour scale breaks.

colours

Optional colour vector replacing the metric palette.

legend_title

Optional colour legend title.

legend_position

Position passed to the ggplot theme. Common values are "right", "bottom", and "none".

show_legend

If FALSE, suppress the colour legend.

symmetric

If TRUE, use limits symmetric around midpoint.

extent

Optional c(xmin, xmax, ymin, ymax) plotting extent.

degree_labels

"auto" uses hemisphere degree labels for longitude-latitude rasters, "hemisphere" always uses them, and "none" uses the default ggplot labels.

study_region

Optional study-region boundary supplied as an sf, sfc, Spatial, SpatVector, or data frame with x and y columns.

region_colour, region_linewidth, region_linetype

Appearance of the optional study-region boundary.

Value

A ggplot object.