View source: R/stacked_bar_plots.R
stacked_bar_plots | R Documentation |
This function generates stacked bar plots for visualizing the relative abundance data of different operational taxonomic units (OTUs) in various samples.
stacked_bar_plots(data, num_samples_per_plot)
data |
A data frame containing the relative abundance data for the OTUs. The first column should contain the OTU IDs, and the subsequent columns should represent samples. |
num_samples_per_plot |
The number of samples to be displayed in each stacked bar plot. |
A list of interactive stacked bar plots, one for each group of samples, showing the relative abundance of OTUs in the samples.
#To run input data
core_1 <- CoreMicrobiome(
otu_table = demo_otu,
tax_table = demo_tax,
metadata_table = demo_md,
filter_type = "occupancy_fun_filter", #Or "abundance_fun_filter", Or "combined_filter"
percent = 0.5,
method = "css", # Or "srs", "rrarefy", "tmm", "tmmwsp", "rle", "upperquartile", "none"
beta_diversity_method = "jaccard",
top_percentage = 10 # Adjust the percentage as needed for core/non-core OTUs
)
#To run the stacked bar plots function
stacked_plots <- stacked_bar_plots(core_1$core_otus_relative_abundance, 10)
#To view the stacked bar plot
stacked_plots[[1]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.