autoplot.permustats: Autoplot Graphics for vegan permustats Objects

autoplot.permustatsR Documentation

Autoplot Graphics for vegan permustats Objects

Description

Alternatives for lattice graphics functions vegan::densityplot.permustats(), vegan::densityplot.permustats() and vegan::boxplot.permustats().

Usage

## S3 method for class 'permustats'
autoplot(
  object,
  plot = c("box", "violin", "density", "qqnorm"),
  scale = FALSE,
  facet = FALSE,
  gg.params = list(),
  ...
)

Arguments

object

object from vegan::permustats().

plot

character; the type of plot, or a geom from ggplot2.

scale

logical; use standardized effect sizes (SES)?

facet

logical; should the plot be faceted by term?

gg.params

list; arguments passed to function drawing the box-like object. Depending on argument plot the parameters are passed to ggplot2::geom_boxplot(), ggplot2::geom_violin(), ggplot2::geom_density() or ggplot2::geom_qq().

...

Other parameters passed to functions (ignored).

Details

Function fortify() returns a data frame with variables permutations (numeric) and term (factor labelling the permutation). The result of fortify() can be used to custom build diagnostic plots. autoplot() provides basic plots of vegan::permustats() objects with limited flexibility.

Examples

data(dune, dune.env)
mod <- cca(dune ~ A1 + Management + Moisture, dune.env)
(ano <- anova(mod, by = "onedf"))
pstat <- permustats(ano)
head(fortify(pstat))
autoplot(pstat, "box")


if (requireNamespace("ggplot2")) {
  library("ggplot2")

  # avoid overplotting x-axis text
  autoplot(pstat, "violin") +
    scale_x_discrete(guide = guide_axis(n.dodge = 2))

  autoplot(pstat, "qqnorm", facet = TRUE) +
    geom_qq_line()
}

autoplot(pstat, "density", facet = TRUE)

gavinsimpson/ggvegan documentation built on June 12, 2025, 7:39 p.m.