Skip to contents

Area and bar plots of sample-level relative abundance at specified taxonomic levels

Usage

plot_abundance(
  pseq,
  top_n = 8,
  taxrank = "Phylum",
  prop_of = "top_n",
  type = "area",
  orderby_OTU,
  PALETTE
)

plot_abundance_by(
  pseq,
  brewerpal = "Set1",
  by,
  type = c("area", "bar"),
  ttle = paste0("Relative phylum abundances by ", by)
)

Arguments

pseq

An object of class phyloseq

top_n

Integer. Number of taxonomic groups to display, sorted by relative abundance

taxrank

Character. Taxonomic rank to display. Should be a column name of the taxa_table in pseq.

prop_of

Character. Either "top_n" or "total". Indicates whether heights of area/bars should represent the proportion out of the displayed taxonomic groups, or the out of the total.

type

Character. Either area or bar, specifying which type of plot. Area displays all samples left to right, whereas bars give mean abundances.

orderby_OTU

Character (optional). The OTU name (i.e. rowname in otu_table) whose relative abundance you would like to sort by. This is what creates the visual gradient from left to right of, say, Firmicutes.

PALETTE

Character of same length top_n of palette for area or bar chart.

brewerpal

Character. Name of RColorBrewer palette to use.

by

Character. Variable in sample_data to stratify plots by.

ttle

Character. Plot title.