gg_envfit | R Documentation |
Fits environmental parameters to an ordination plot of sites and plots them as arrows.
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
)
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. |
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.
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.