Sort taxa by summed abundance across all samples and plot sorted taxon composition with a bar per sample

groupBarplot(
abundances,
groups = c(),
aggregate = "none",
taxon.color.map = NULL,
group.color.map = NULL,
topTaxa = 10,
sortGroupwise = TRUE,
sumGroupwise = FALSE,
group.order = c(),
hide.taxa = c(),
randSampleNum = NA,
summedTaxonColor = "#a9a9a9",
extendTaxonColorMap = FALSE,
legend = TRUE,
legend.shift = 1,
legend.hidegroups = FALSE,
...
)

## Arguments

abundances a matrix with taxa as rows and samples as columns group membership vector with as many entries as samples if groups are given, plot the aggregate across the group (or its selected samples if randSampleNum is true); possible values: none, median and mean map of taxon-specific colors, should match row names; taxa not present in the color map will be colored in summedTaxonColor map of group-specific colors, should match group names number of top taxa to be plotted if true, samples are sorted according to groups if true, taxa are summed and sorted separately across samples within each group (if true, samples are always sorted group-wise) if a vector with group names (one for each group) is given, group samples will be sorted in the order indicated; can also be used to only plot selected groups do not consider these taxa as top-abundant taxa, but keep them among Others if larger 0, sortGroupwise is set to true and the indicated sample number is randomly selected for each group the color of the summed taxa, by default gray if true, taxa not in the taxon color map are added there and the extended color map is returned add a legend with the color code increase/decrease this parameter to shift the color legend further to the right/left do not show the group memberships in the legend Additional arguments passed to plot()

## Value

if extendTaxonColorMap is true, the taxon color map is returned

## Details

Note that taxa are always summed across all samples, also in the presence of a group membership vector, unless sumGroupwise is true.

## Examples

data(ibd_taxa)
#> [1] "Number of samples in group Control : 34"