| geom_xnicher_ellipse | R Documentation |
xnicher modelBuilds a self-contained ggplot2 layer that traces one or more
iso-suitability ellipses implied by a fitted 2-D xnicher model.
The ellipse for level \alpha is the contour
S(x) = \alpha, equivalently
(x - \mu)^\top \Sigma^{-1} (x - \mu) = -2 \log \alpha when
level_type = "suitability", or the chi-squared confidence ellipse
(x - \mu)^\top \Sigma^{-1} (x - \mu) =
\mathtt{qchisq}(\alpha, df = 2) when level_type = "chisq".
geom_xnicher_ellipse(
model,
level = c(0.95, 0.5, 0.05),
level_type = c("suitability", "chisq"),
n = 200L,
linewidth = 0.6,
colour = "firebrick",
...
)
model |
A |
level |
Numeric vector of contour levels in |
level_type |
Either |
n |
Integer number of points around each ellipse. Default 200. |
linewidth |
Path linewidth (or |
colour |
Path colour. |
... |
Additional fixed parameters passed to |
For length(level) > 1 the layer carries one column level
grouping the closed ellipse paths so a single geom_path draws
them all. Map e.g. linetype = factor(level) downstream to
distinguish them visually.
A ggplot2 layer.
library(ggplot2)
fit <- optimize_niche(
env_occ = example_env_occ_2d,
env_m = example_env_m_2d,
num_starts = 5L
)
ggplot() +
geom_xnicher_background(example_env_m_2d) +
geom_xnicher_occ(example_env_occ_2d) +
geom_xnicher_ellipse(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.