Create an area plot for longitudinal samples with ggplot2 package.

plot_area(
  x,
  xvar = NULL,
  level = NULL,
  facet.by = NULL,
  fill.colors = brewer.pal(6, "Paired"),
  abund.thres = 0.001,
  prev.thres = 0.5,
  ncol = 5,
  nrow = 5
)

Arguments

x

phyloseq-class object.

xvar

Column name to plot on x-axis.

level

Taxonomic level. OTU/ASV level not supported.

facet.by

Column with variable that has multiple measurements.

fill.colors

brewer.pal(6,"Paired"). Specify colors.

abund.thres

= 0.001 check microbiome package aggregate_rare function.

prev.thres

= 0.1 check microbiome package aggregate_rare function.

ncol

wrap, specify number of columns.

nrow

wrap, specify number of rows.

Value

ggplot object.

Examples

if (FALSE) {
library(microbiomeutilities)
data("hmp2")
ps <- hmp2
ps.rel <- microbiome::transform(ps, "compositional") 
p <- plot_area(ps.rel, xvar="visit_number", 
              level = "Phylum",
              facet.by = "subject_id",
              fill.colors=brewer.pal(6,"Paired"))
}