Description Usage Arguments Details Value Author(s) Examples
Output cca ordination plot produced by cca
.
1 2 3 4 5 6 7 8 9 10 11 | ggcca(ord, groups = NULL, axes = c(1, 2), display = "bp", scaling = 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. |
display |
Scores shown. These must include some of the alternatives species or sp for species scores, sites or wa for site scores, lc for linear constraints or "LC scores", or bp for biplot arrows or cn for centroids of factor constraints instead of an arrow |
scaling |
Scaling for species and site scores. Either species (2) or site (1) scores are scaled by eigenvalues, and the other set of scores is left unscaled, or with 3 both are scaled symmetrically by square root of eigenvalues. Unscaled raw scores stored in the result can be accessed with scaling = 0. The type of scores can also be specified as one of "none", "sites", "species", or "symmetric", which correspond to the values 0, 1, 2, and 3 respectively. |
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 33 34 | data(Spes)
data(Envs)
library(vegan)
# get group factor
Spe.w <- hclust(dist(scale(Spes)), "ward.D")
gr <- cutree(Spe.w , k=4)
grl <- factor(gr)
# Compute CCA
Spe.cca <- cca(Spes, Envs)
head(summary(Spe.cca))
# Produce a plot
ggcca(Spe.cca)
# Add a group
ggcca(Spe.cca, group = grl)
# Set a theme
require(ggplot2)
ggcca(Spe.cca, group = grl, fcol = "white", facol = "white") + theme_dark()
# Remove the arrow
ggcca(Spe.cca, group = grl, spearrow = NULL)
# Modify legend title, group color and point shape
ggcca(Spe.cca, 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
ggcca(Spe.cca, 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.