Plot taxon abundance for samples. It is a legacy function from microbiome
.
plot_taxa_composition(
x,
sample.sort = NULL,
taxonomic.level = "Phylum",
transform = "compositional",
otu.sort = NULL,
palette = brewer.pal(12, "Paired"),
x.label = "sample",
plot.type = "barplot",
average_by = NULL,
verbose = FALSE,
mar = c(5, 12, 1, 1),
...
)
phyloseq-class
object
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.
Merge the OTUs (for phyloseq object) into a higher taxonomic level. This has to be one from colnames(tax_table(x)).
Data transform to be used in plotting (but not in sample/taxon ordering). The options are 'Z-OTU', 'Z-Sample', 'log10' and 'compositional'. See the transform
function.
Order taxa. Same options as for the sample.sort argument but instead of metadata, taxonomic table is used. Also possible to sort by 'abundance'.
The number and palette RColorBrewer
has to be specified e.g brewer.pal(12, "Paired").
Specify how to label the x axis. This should be one of the variables in sample_variables(x).
Plot type: 'barplot' or 'lineplot'.
Variable to group.
verbose.
Figure margins.
Arguments to be passed (for neatsort
function)
A ggplot
plot object.
if (FALSE) {
# Example data
library(microbiome)
library(microbiomeutilities)
data("biogeogut")
pseq <- biogeogut
plot_taxa_composition(pseq, taxonomic.level = "Phylum")
}