plot_scree: General ordination eigenvalue plotter using ggplot2.

Description Usage Arguments Value See Also Examples

View source: R/plot-methods.R

Description

Convenience wrapper for plotting ordination eigenvalues (if available) using a ggplot2-graphic.

Usage

1
plot_scree(ordination, title = NULL)

Arguments

ordination

(Required). An ordination object. Many different classes of ordination are defined by R packages. Ordination classes currently supported/created by the ordinate function are supported here. There is no default, as the expectation is that the ordination will be performed and saved prior to calling this plot function.

title

(Optional). Default NULL. Character string. The main title for the graphic.

Value

A ggplot plot object, graphically summarizing the ordination result for the specified axes.

See Also

plot_ordination

ordinate

distance

phyloseq online tutorials

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# First load and trim a dataset
data("GlobalPatterns")
GP = prune_taxa(names(sort(taxa_sums(GlobalPatterns), TRUE)[1:50]), GlobalPatterns)
# Test plots (preforms ordination in-line, then makes scree plot)
plot_scree(ordinate(GP, "DPCoA", "bray"))
plot_scree(ordinate(GP, "PCoA", "bray"))
# Empty return with message
plot_scree(ordinate(GP, "NMDS", "bray"))
# Constrained ordinations
plot_scree(ordinate(GP, "CCA", formula=~SampleType))
plot_scree(ordinate(GP, "RDA", formula=~SampleType)) 
plot_scree(ordinate(GP, "CAP", formula=~SampleType)) 
# Deprecated example of constrained ordination (emits a warning)
#plot_scree(ordinate(GP ~ SampleType, "RDA")) 
plot_scree(ordinate(GP, "DCA"))
plot_ordination(GP, ordinate(GP, "DCA"), type="scree")

Example output

Square root transformation
Wisconsin double standardization
Run 0 stress 0.153798 
Run 1 stress 0.1885161 
Run 2 stress 0.1577043 
Run 3 stress 0.1684335 
Run 4 stress 0.1930369 
Run 5 stress 0.1462585 
... New best solution
... Procrustes: rmse 0.04443251  max resid 0.1288562 
Run 6 stress 0.2767173 
Run 7 stress 0.1462102 
... New best solution
... Procrustes: rmse 0.08231987  max resid 0.1976477 
Run 8 stress 0.1459991 
... New best solution
... Procrustes: rmse 0.02192912  max resid 0.07824771 
Run 9 stress 0.2020778 
Run 10 stress 0.1875078 
Run 11 stress 0.1462585 
... Procrustes: rmse 0.08655941  max resid 0.229996 
Run 12 stress 0.1807685 
Run 13 stress 0.1537979 
Run 14 stress 0.153798 
Run 15 stress 0.149567 
Run 16 stress 0.1462585 
... Procrustes: rmse 0.08655395  max resid 0.2299845 
Run 17 stress 0.1615776 
Run 18 stress 0.1462585 
... Procrustes: rmse 0.08657888  max resid 0.2300238 
Run 19 stress 0.149042 
Run 20 stress 0.1462585 
... Procrustes: rmse 0.08655572  max resid 0.2299887 
*** No convergence -- monoMDS stopping criteria:
    18: stress ratio > sratmax
     2: scale factor of the gradient < sfgrmin
No eigenvalues found in ordination
NULL

phyloseq documentation built on Nov. 8, 2020, 6:41 p.m.