plot_density {microbiome} | R Documentation

## Plot Density

### Description

Plot abundance density across samples for a given taxon.

### Usage

    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

    # 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()

[Package microbiome version 1.6.0 Index]