Skip to contents

The environments available to the two groups (grey; darker where both have them) and their niches in the shared space: environments occupied by both (stability), only by the first group (unfilling) and only by the second (expansion), with the 50% contour of each group's occupancy. Legend entries give the number and share of occupied cells.

Usage

plot_niche_overlap(
  x,
  pair = 1,
  limits = "available",
  margin = 0.1,
  base_size = 11,
  file = NULL,
  width = 2250,
  height = 1800
)

Arguments

x

A result of niche_overlap().

pair

Which pair of groups (row of x$pairs).

limits

The part of the space shown: "available" (default, all environments available to either group), "niches" (zoom to the occupied envelopes of the pair, for niches much narrower than the available environment), or c(xmin, xmax, ymin, ymax) in axis units (e.g. to show several pairs or analyses on the same scale).

margin

Space added around the "available" or "niches" window, as a share of its width and height (not beyond the grid of the densities, which ends at the most extreme record or background point).

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 (PDF and SVG at 300 pixels per inch).

Value

A ggplot object.

References

Broennimann, O. et al. (2012) Measuring ecological niche overlap from occurrence and spatial environmental data. Global Ecology and Biogeography 21, 481-497. doi:10.1111/j.1466-8238.2011.00698.x

Examples

sim <- simulate_enm_data(seed = 1)
pres <- sim$presence
pres$group <- ifelse(pres$lon < 19, "west", "east")
plot_niche_overlap(niche_overlap(pres, sim$env, n_rep = 0))