taxa_boxplot | R Documentation |
Visualize BIOM data with boxplots.
taxa_boxplot(
biom,
x = NULL,
rank = -1,
layers = "x",
taxa = 6,
unc = "singly",
other = FALSE,
p.top = Inf,
stat.by = x,
facet.by = NULL,
colors = TRUE,
shapes = TRUE,
patterns = FALSE,
flip = FALSE,
stripe = NULL,
ci = "ci",
level = 0.95,
p.adj = "fdr",
outliers = NULL,
xlab.angle = "auto",
p.label = 0.05,
transform = "none",
y.transform = "sqrt",
caption = TRUE,
...
)
biom |
An rbiom object, such as from |
x |
A categorical metadata column name to use for the x-axis. Or
|
rank |
What rank(s) of taxa to display. E.g. |
layers |
One or more of
|
taxa |
Which taxa to display. An integer value will show the top n
most abundant taxa. A value 0 <= n < 1 will show any taxa with that
mean abundance or greater (e.g. |
unc |
How to handle unclassified, uncultured, and similarly ambiguous taxa names. Options are:
Abbreviations are allowed. Default: |
other |
Sum all non-itemized taxa into an "Other" taxa. When
|
p.top |
Only display taxa with the most significant differences in
abundance. If |
stat.by |
Dataset field with the statistical groups. Must be
categorical. Default: |
facet.by |
Dataset field(s) to use for faceting. Must be categorical.
Default: |
colors |
How to color the groups. Options are:
See "Aesthetics" section below for additional information.
Default: |
shapes |
Shapes for each group.
Options are similar to |
patterns |
Patterns for each group.
Options are similar to |
flip |
Transpose the axes, so that taxa are present as rows instead
of columns. Default: |
stripe |
Shade every other x position. Default: same as flip |
ci |
How to calculate min/max of the crossbar,
errorbar, linerange, and pointrange layers.
Options are: |
level |
The confidence level for calculating a confidence interval.
Default: |
p.adj |
Method to use for multiple comparisons adjustment of
p-values. Run |
outliers |
Show boxplot outliers? |
xlab.angle |
Angle of the labels at the bottom of the plot.
Options are |
p.label |
Minimum adjusted p-value to display on the plot with a bracket.
If a numeric vector with more than one value is
provided, they will be used as breaks for asterisk notation.
Default: |
transform |
Transformation to apply. Options are:
|
y.transform |
The transformation to apply to the y-axis. Visualizing differences of both high- and low-abundance taxa is best done with a non-linear axis. Options are:
These methods allow visualization of both high- and low-abundance
taxa simultaneously, without complaint about 'zero' count
observations. Default: |
caption |
Add methodology caption beneath the plot.
Default: |
... |
Additional parameters to pass along to ggplot2 functions.
Prefix a parameter name with a layer name to pass it to only that
layer. For instance, |
A ggplot2
plot. The computed data points, ggplot2 command,
stats table, and stats table commands are available as $data
,
$code
, $stats
, and $stats$code
, respectively.
All built-in color palettes are colorblind-friendly. The available
categorical palette names are: "okabe"
, "carto"
, "r4"
,
"polychrome"
, "tol"
, "bright"
, "light"
,
"muted"
, "vibrant"
, "tableau"
, "classic"
,
"alphabet"
, "tableau20"
, "kelly"
, and "fishy"
.
Patterns are added using the fillpattern R package. Options are "brick"
,
"chevron"
, "fish"
, "grid"
, "herringbone"
, "hexagon"
, "octagon"
,
"rain"
, "saw"
, "shingle"
, "rshingle"
, "stripe"
, and "wave"
,
optionally abbreviated and/or suffixed with modifiers. For example,
"hex10_sm"
for the hexagon pattern rotated 10 degrees and shrunk by 2x.
See fillpattern::fill_pattern()
for complete documentation of options.
Shapes can be given as per base R - numbers 0 through 17 for various shapes, or the decimal value of an ascii character, e.g. a-z = 65:90; A-Z = 97:122 to use letters instead of shapes on the plot. Character strings may used as well.
Other taxa_abundance:
sample_sums()
,
taxa_clusters()
,
taxa_corrplot()
,
taxa_heatmap()
,
taxa_stacked()
,
taxa_stats()
,
taxa_sums()
,
taxa_table()
Other visualization:
adiv_boxplot()
,
adiv_corrplot()
,
bdiv_boxplot()
,
bdiv_corrplot()
,
bdiv_heatmap()
,
bdiv_ord_plot()
,
plot_heatmap()
,
rare_corrplot()
,
rare_multiplot()
,
rare_stacked()
,
stats_boxplot()
,
stats_corrplot()
,
taxa_corrplot()
,
taxa_heatmap()
,
taxa_stacked()
library(rbiom)
biom <- rarefy(hmp50)
taxa_boxplot(biom, stat.by = "Body Site", stripe = TRUE)
taxa_boxplot(biom, layers = "bed", rank = c("Phylum", "Genus"), flip = TRUE)
taxa_boxplot(
biom = subset(biom, `Body Site` %in% c('Saliva', 'Stool')),
taxa = 3,
layers = "ps",
stat.by = "Body Site",
colors = c('Saliva' = "blue", 'Stool' = "red") )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.