Group samples for rarefaction

Hello. I am trying to figure out how to group samples based on metadata for rarefaction curves. I have a phyloseq object and I can get rarefaction curves for all the samples in my dataset by using:

rarecurve(t(otu_table(physeq)), step = 100, cex = 0.5, label = FALSE, xlim= c(0,20000))

However, I would like to group samples by species so that I only have 13 curves instead of several hundred. How can I do that?

Update - I figured it out by grouping my table before importation as a phyloseq object.

Now I have a different problem:

I noticed that when I set a limit on my rarefaction curves in order to zoom in, I lose the nice labels on the lines. They seem to only show if I let the graph go to completion.
Here is the graph to completion with labels:

And here is what happens when I use xlim to set a limit to my x-axis:

How can I keep those labels?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.