plot_density: Plot Density

Description Usage Arguments Value Examples

View source: R/plot_density.R

Description

Plot abundance density across samples for a given taxon.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
plot_density(
  x,
  variable = NULL,
  log10 = FALSE,
  adjust = 1,
  kernel = "gaussian",
  trim = FALSE,
  na.rm = FALSE,
  fill = "gray",
  tipping.point = NULL,
  xlim = NULL
)

Arguments

x

phyloseq-class object or an OTU matrix (samples x phylotypes)

variable

OTU or metadata variable to visualize

log10

Logical. Show log10 abundances or not.

adjust

see stat_density

kernel

see stat_density

trim

see stat_density

na.rm

see stat_density

fill

Fill color

tipping.point

Optional. Indicate critical point for abundance variations to be highlighted.

xlim

X axis limits

Value

A ggplot plot object.

Examples

1
2
3
4
5
6
7
8
9
# Load gut microbiota data on 1006 western adults
# (see help(atlas1006) for references and details)
data(dietswap)
# Use compositional abundances instead of absolute signal
pseq.rel <- transform(dietswap, 'compositional')
# Population density for Dialister spp.; with log10 on the abundance (X)
# axis
library(ggplot2)
p <- plot_density(pseq.rel, variable='Dialister') + scale_x_log10()

microbiome documentation built on Nov. 8, 2020, 5:08 p.m.