Description Usage Arguments Details Value Author(s) Examples
Output nmds ordination plot.
1 2 3 4 5 6 7 8 9 10 | ggnmds(ord, groups = NULL, axes = c(1, 2), obslab = FALSE,
moblabs = NULL, obssize = 2, obscol = "black", obspch = 16,
obsFonts = "serif", obsface = "plain", spe = TRUE, msplabs = NULL,
spearrow = 0.2, spelab = TRUE, spmapsize = NULL, spaline = 1,
spalwd = 0.5, spacol = "grey30", sprotate = NULL, spesize = 4,
specol = "red", spepch = 16, speFonts = "serif", speface = "plain",
envs = NULL, mflabs = NULL, farrow = 0.2, fmapsize = NULL,
faline = 1, falwd = 0.5, facol = "blue", fzoom = 1, frotate = NULL,
fsize = 5, fcol = "blue", fFonts = "serif", fface = "plain",
ellipse = FALSE, ellprob = 0.95, cirlwd = 1, cirline = 2)
|
ord |
An object produced by |
groups |
An grouping factor, its length is the same as the row number of the ordination dataframe. |
axes |
Axes shown. |
obslab |
A logical value, obslab = FALSE(The row variables are displayed as points), obslab = TRUE(The row variables are displayed as texts). |
moblabs |
A vector of strings, rename the row variable names displayed. |
obssize |
The size of row variables. |
obscol |
The colour of row variables. |
obspch |
The point shape of row variables. |
obsFonts |
The family of row variables. |
obsface |
The fontface of row variables. |
spe |
A logical value, whether the column variables are displayed. |
msplabs |
A vector of strings, rename the col variable names displayed. |
spearrow |
Arrowhead length of col variables. |
spelab |
A logical value, spelab = FALSE(The col variables are displayed as points), spelab = TRUE(The col variables are displayed as texts). |
spmapsize |
Numeric value, the size of col variable labels is mapped by the length of arrowhead. |
spaline |
Type of arrowhead segment. |
spalwd |
Numeric value, the width of arrowhead segment. |
spacol |
The colour of arrowhead segment. |
sprotate |
Numeric value, rotation angle of col variable labels. |
spesize |
Numeric value, the size of col variable labels or points. |
specol |
The colour of col variable labels or opoints. |
spepch |
Type of col variable labels or points . |
speFonts |
The family of col variable labels. |
speface |
The fontface of col variable labels. |
envs |
Dataframe fitted. |
mflabs |
A vector of strings, rename the fitted variable names displayed. |
farrow |
Arrowhead length of fitted variables. |
fmapsize |
Numeric value, the size of fitted variable labels is mapped by the length of arrowhead. |
faline |
Arrowhead type of fitted variables. |
falwd |
Numeric value, arrowhead width of fitted variables. |
facol |
Arrowhead colour of fitted variables. |
fzoom |
Numeric value, scaling arrow length. |
frotate |
Numeric value, rotation angle of fitted variable labels. |
fsize |
Numeric value, the size of fitted variable labels or points. |
fcol |
The colour of fitted variable labels or opoints. |
fFonts |
The family of fitted variable labels. |
fface |
The fontface of fitted variable labels. |
ellipse |
A logical value, whether confidence ellipses are displayed. |
ellprob |
Numeric value, confidence interval. |
cirlwd |
Numeric value, line width of ellipse. |
cirline |
Line type of ellipse. |
Control of some parts is put in the function. Theme of figure can be set by theme of ggplot2.
Returns a ggplot object.
Dongya Wang <wdy91617@163.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | data(Envs)
library(vegan)
#get group factor
Env.w <- hclust(dist(scale(Envs)), "ward.D")
gr <- cutree(Env.w , k=4)
grl <- factor(gr)
# Compute NMDS
Env.nmds <- metaMDS(Envs, distance="bray")
# Produce a plot
ggnmds(Env.nmds)
# Add a group
ggnmds(Env.nmds, group = grl)
# Set a theme
require(ggplot2)
ggnmds(Env.nmds, group = grl, fcol = "white", facol = "white") + theme_dark()
# Remove the arrow
ggnmds(Env.nmds, group = grl, spearrow = NULL)
# Modify legend title, group color and point shape
ggnmds(Env.nmds, group = grl, spearrow = NULL) +
scale_color_manual(name = "Groups",values = c("red2", "purple1", "grey20","cyan")) +
scale_shape_manual(name = "Groups",values = c(8,15,16,17))
#Add confidence ellipses
ggnmds(Env.nmds, group = grl, spearrow = NULL, ellipse = TRUE) +
scale_colour_hue(l = 70, c = 300)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.