ggbartax: taxonomy barplot

View source: R/plot-ggbartaxa.R

ggbartaxR Documentation

taxonomy barplot

Description

taxonomy barplot

Usage

ggbartax(obj, ...)

ggbartaxa(obj, ...)

## S3 method for class 'phyloseq'
ggbartax(obj, ...)

## S3 method for class 'data.frame'
ggbartax(
  obj,
  mapping = NULL,
  position = "stack",
  stat = "identity",
  width = 0.7,
  topn = 30,
  count = FALSE,
  sampleda = NULL,
  factorLevels = NULL,
  sampleLevels = NULL,
  facetNames = NULL,
  plotgroup = FALSE,
  groupfun = mean,
  ...
)

Arguments

obj

phyloseq, phyloseq class or data.frame, (nrow sample * ncol feature (factor)) or the data.frame for geom_bar.

...

additional parameters, see ggplot

mapping

set of aesthetic mapping of ggplot2, default is NULL, if the data is the data.frame for geom_bar, the mapping should be set.

position

character, default is 'stack'.

stat

character, default is 'identity'.

width

numeric, the width of bar, default is 0.7.

topn

integer, the top number of abundance taxonomy(feature).

count

logical, whether show the relative abundance.

sampleda

data.frame, (nrow sample * ncol factor), the sample information, if the data doesn't contain the information.

factorLevels

vector or list, the levels of the factors (contained names e.g. list(group=c("B","A","C")) or c(group=c("B","A","C"))), adjust the order of facet, default is NULL, if you want to order the levels of factor, you can set this.

sampleLevels

vector, adjust the order of x axis e.g. c("sample2", "sample4", "sample3"), default is NULL.

facetNames

character, default is NULL.

plotgroup

logical, whether calculate the mean or median etc for each group, default is FALSE.

groupfun

character, how to calculate for feature in each group, the default is 'mean', this will plot the mean of feature in each group.

Value

barplot of tax

Author(s)

Shuangbin Xu

Examples

## Not run: 
    library(ggplot2)
    data(test_otu_data)
    test_otu_data %<>% as.phyloseq()
    otubar <- ggbartax(test_otu_data) + 
              xlab(NULL) + ylab("relative abundance(%)")

## End(Not run)

YuLab-SMU/MicrobiotaProcess documentation built on Nov. 8, 2024, 4:37 p.m.