gg_envfit: Vegan envfit plot

View source: R/gg_envfit.R

gg_envfitR Documentation

Vegan envfit plot

Description

Fits environmental parameters to an ordination plot of sites and plots them as arrows.

Usage

gg_envfit(
  ord,
  env,
  groups = NA,
  scaling = 1,
  choices = c(1, 2),
  perm = 999,
  alpha = 0.05,
  angle = 20,
  len = 0.5,
  unit = "cm",
  arrow.col = "red",
  pt.size = 3,
  plot = TRUE
)

Arguments

ord

An ordination object.

env

A data frame of environmental parameters.

groups

A vector of groups.

scaling

Scaling value for plot.

choices

Axes to plot.

perm

Number of permutations.

alpha

Maximum alpha value to be included in plot.

angle

Angle of arrow tips.

len

Arrow tip length.

unit

Unit for length ("cm", "in")

arrow.col

Arrow color.

pt.size

Symbol size.

plot

A logical for plotting; defaults to TRUE.

Value

Silently returns the plot and data frames used for the plotting if the fit of any variable is significant at alpha. Otherwise returns a message that no variable is significant.

Note

In order for the arrow tips to be labeled with the names of the variables, they must be supplied as a matrix or data frame. If a single variable is supplied as a vector, the arrow tip will be labeled with "1". A way-around is to convert the vector to a data frame with the column named for the variable.

Examples

data("varespec")
data("varechem")
vare.dist <- vegdist(varespec)
vare.mds <- monoMDS(vare.dist)
gg_envfit(ord=vare.mds, env=varechem)

data("dune")
data("dune.env")
dune.dist <- vegdist(dune)
dune.mds <- monoMDS(dune.dist)
# A1 supplied as a vector
gg_envfit(dune.mds, env=dune.env$A1, groups=dune.env$Management)
# A1 supplied as a data frame
A1 <- as.data.frame(dune.env$A1)
colnames(A1) <- "A1"
gg_envfit(dune.mds, env=A1, groups=dune.env$Management)


ggordiplots documentation built on June 22, 2024, 12:05 p.m.