Learn R Programming

barrel (version 0.1.0)

autoplot.barrel_ord: Autoplot method for barrel_ord objects

Description

Generates a ggplot of site scores from a vegan ordination object with optional group ellipses, centroids, and environmental arrows. This method is designed to work with ordination objects prepared using barrel_prepare.

Usage

# S3 method for barrel_ord
autoplot(object, ...)

Value

A ggplot2 object with ordination scores and optional graphical layers.

Arguments

object

An object of class "barrel_ord" (a vegan ordination object with attached metadata).

...

Additional arguments:

group

Character. Grouping variable in the metadata. (Required)

data

Optional species or environmental data for envfit.

kind

Type of ellipse: "se" or "sd". Default is "se".

method

Covariance method: "classic" or "robust". Default is "classic".

conf

Confidence level for ellipses. Default is 0.95.

geom_type

"polygon" or "path" for ellipse. Default is "polygon".

show_arrows

Logical; whether to show envfit vectors. Default is TRUE.

show_centroids

Logical. Default is FALSE.

show_ellipses

Logical. Default is TRUE.

show_labels

Logical. Label envfit arrows. Default is TRUE.

p_thresh

Numeric. Significance threshold for arrows. Default 0.05.

alpha

Numeric. Transparency of ellipses. Default is 0.5.

Details

If geom_type = "polygon", group colors are mapped to fill for ellipses. If geom_type = "path", group colors are mapped to color. The grouping variable must be present in the metadata provided to barrel_prepare.

See Also

barrel_prepare, stat_barrel, rda, metaMDS

Examples

Run this code
library(vegan)
data(dune)
data(dune.env)
ord <- rda(dune, scale = TRUE)
ord <- barrel_prepare(ord, dune.env)
ggplot2::autoplot(ord,
  group = "Management", data = dune,
  method = "robust", kind = "sd", geom_type = "polygon", show_arrows = TRUE
)

Run the code above in your browser using DataLab