This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to make alpha diversity boxplot?

How to make alpha diversity boxplot? I am trying to perform alpha diversity and I performed scatter plot for shannon measure,How can I make boxplot??

meta.physeq = sample_data(meta)

tax <- otu_table(tax,taxa_are_rows=FALSE)

physeq.alpha = phyloseq(ASV, tax, meta.physeq)

sample_data(physeq.alpha)$shannon.physeq <- estimate_richness(physeq.alpha, measures="Shannon")

plot_richness(physeq.alpha, measures="Shannon")enter image description here

alpha_diversity taxa asv box_plot shannon

Use plot_richness() directly with your phyloseq object instead estimate_richness, define "x=Treatment", with your groups-treatments, etc.

so no boxplot function? what do you mean by x=Treatment? do you mean groups of meta data? please write your code to make it clearer to me

yes, you need a function from ggplot2.

1 answer

you need to add a ggplot function:

p <- plot_richness(physeq.alpha, x = "Treatment", measures="Shannon")
p + geom_boxplot()

thanks a lot! can't believe that is so simple

Log in to answer this question.