I'm trying to generate a rarefaction curve plot from a phyloseq object. I'm using the function ggrare using rarecurve function from the vegan package:

The function rarecurve allow the ploting of all the samples but I can't group the samples by metadata variable

Here is my code for the rarefaction curve plot

pRare <- ggrare(epi_physeq_3.5ans, step = 100,color = "cluster_3a", label = "cluster_3a") 

#epi_physeq_3.5ans : phyloseq object
#cluster_3a : metadata variable

enter image description here

This give me the curve for all samples with different colors according to the cluster_3a variable.

Howerver I want to plot only 2 curves wich are the average species richness with standar error bars for each group.

Something like from : https://doi.org/10.1038/srep08397 enter image description here

I can't find any package in R that allow grouping samples for plotting rarefaction curves.

Do you know any package or any idea of how that can be done ?

  • $\begingroup$ Maybe there isn't any but you can use the data from vegan to draw yourself the lines (however, note that it might be better/easier if you used geom_smooth) $\endgroup$
    – llrs
    Jun 21 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.