Skip to contents

Draw sample-wise abundance distributions for selected taxa.

Usage

plot_abundance(
  object,
  taxonomic_rank = c("Kingdom", "Phylum", "Class", "Order", "Family", "Genus", "Species"),
  taxa = NULL,
  top_n = 10,
  x = "sample_id",
  geom = c("boxplot", "violin", "point"),
  relative = TRUE
)

Arguments

object

A microbiome_dataset object.

taxonomic_rank

Taxonomic rank used for aggregation.

taxa

Optional taxa to keep. Defaults to the most abundant taxa.

top_n

Number of taxa shown when taxa is not supplied.

x

Sample metadata column shown on the x axis.

geom

Geometry used to display abundance.

relative

Whether to show relative abundance.

Value

A ggplot object.

Examples

data("global_patterns", package = "microbiomedataset")

plot_abundance(
  object = global_patterns,
  taxonomic_rank = "Phylum",
  x = "SampleType",
  top_n = 6
)
#> Ignoring unknown labels:
#>  colour : "Phylum"