plot_bar: Stacked bar plot for SummarizedPhyloseq data

Description Usage Arguments Author(s) Examples

Description

This function uses the ggplot2 package to generate barplot from a given SummarizedPhyloseq-class object on a given phylogenic level. The output is a ggplot object so it can be easily styled using additional ggplot functions.

Usage

1
plot_bar(spy, level = "Phylum", by = NULL, show.legend = TRUE)

Arguments

spy

SummarizedPhyloseq-class

level

Character. The phyloseq level to use. Must be one of Kingdom, Phylum, Class, Order, Family, Genus, or Species.

by

Character. The sample meta-data variable to plot the abundance data againt to. It must be from the sample data's column names. If multiple variables are givin, facets will be used. The default is sample name. See examples.

legend.show

Logical variable whether to show the legends.

plotly

Logical value. If TRUE, a plotly variable will be returned.

Author(s)

Chenghao Zhu

Examples

1
2
3
4
5
6
7
8
data(fatigue)
fatigue = transform_sample_counts(physeq, function(x) x/sum(x))
spy = summarizeFromPhyloseq(fatigue)
plot_bar(spy)
plot_bar(spy, "Phylum", by = "Subject")
plot_bar(spy, "Genus", by = c("Subject", "Sex"))
plot_bar(spy, "Genus", by = c("Subject", "Sex"), plotly = T)
plot_bar(spy, "Phylum", by = c("Subject", "age_range", "Sex"))

zhuchcn/phylox documentation built on May 31, 2019, 5:14 p.m.