Plot alpha diversity, flexibly with ggplot2
There are many useful examples of alpha-diversity graphics in the
phyloseq online tutorials.
This function estimates a number of alpha-diversity metrics using the
estimate_richness
function,
and returns a ggplot
plotting object.
The plot generated by this function will include every sample
in physeq
, but they can be further grouped on the horizontal axis
through the argument to x
,
and shaded according to the argument to color
(see below).
You must use untrimmed, non-normalized count data for meaningful results,
as many of these estimates are highly dependent on the number of singletons.
You can always trim the data later on if needed,
just not before using this function.
plot_richness(physeq, x = "samples", color = NULL, shape = NULL, title = NULL, scales = "free_y", nrow = 1, shsi = NULL, measures = NULL, sortby = NULL)
physeq |
(Required). |
x |
(Optional). A variable to map to the horizontal axis. The vertical
axis will be mapped to the alpha diversity index/estimate
and have units of total taxa, and/or index value (dimensionless).
This parameter ( The default value is |
color |
(Optional). Default |
shape |
(Optional). Default |
title |
(Optional). Default |
scales |
(Optional). Default |
nrow |
(Optional). Default is |
shsi |
(Deprecated). No longer supported. Instead see 'measures' below. |
measures |
(Optional). Default is |
sortby |
(Optional). A character string subset of |
NOTE: Because this plotting function incorporates the output from
estimate_richness
, the variable names of that output should
not be used as x
or color
(even if it works, the resulting
plot might be kindof strange, and not the intended behavior of this function).
The following are the names you will want to avoid using in x
or color
:
c("Observed", "Chao1", "ACE", "Shannon", "Simpson", "InvSimpson", "Fisher")
.
A ggplot
plot object summarizing
the richness estimates, and their standard error.
There are many more interesting examples at the phyloseq online tutorials.
## There are many more interesting examples at the phyloseq online tutorials. ## http://joey711.github.io/phyloseq/plot_richness-examples data("soilrep") plot_richness(soilrep, measures=c("InvSimpson", "Fisher")) plot_richness(soilrep, "Treatment", "warmed", measures=c("Chao1", "ACE", "InvSimpson"), nrow=3) data("GlobalPatterns") plot_richness(GlobalPatterns, x="SampleType", measures=c("InvSimpson")) plot_richness(GlobalPatterns, x="SampleType", measures=c("Chao1", "ACE", "InvSimpson"), nrow=3) plot_richness(GlobalPatterns, x="SampleType", measures=c("Chao1", "ACE", "InvSimpson"), nrow=3, sortby = "Chao1")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.