plot_composition {microbiome} | R Documentation

## Taxonomic Composition Plot

### Description

Plot taxon abundance for samples.

### Usage

    plot_composition(x, sample.sort = NULL, otu.sort = NULL,
      x.label = "sample", plot.type = "barplot", verbose = FALSE, mar = c(5,
      12, 1, 1), average_by = NULL, ...)

### Arguments

`x` | `phyloseq-class` object
`sample.sort` | Order samples. Various criteria are available: NULL or 'none': No sorting A single character string: indicate the metadata field to be used for ordering A character vector: sample IDs indicating the sample ordering. 'neatmap' Order samples based on the neatmap approach. See `neatsort`. By default, 'NMDS' method with 'bray' distance is used. For other options, arrange the samples manually with the function.
`otu.sort` | Order taxa. Same options as for the sample.sort argument but instead of metadata, taxonomic table is used. Also possible to sort by 'abundance'.
`x.label` | Specify how to label the x axis. This should be one of the variables in sample_variables(x).
`plot.type` | Plot type: 'barplot' or 'heatmap'
`verbose` | verbose (but not in sample/taxon ordering). The options are 'Z-OTU', 'Z-Sample', 'log10' and 'compositional'. See the `transform` function.
`mar` | Figure margins
`average_by` | Average the samples by the average_by variable
`...` | Arguments to be passed (for `neatsort` function)

### Value

A `ggplot` plot object.

### Examples

    data(dietswap)
    pseq <- subset_samples(dietswap, group == 'DI' & nationality == 'AFR')
    p <- plot_composition(pseq)

[Package microbiome version 1.0.2 Index]