joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
581 stars 187 forks source link

How to decrease x axis size of rarefaction curve #1738

Open Avtober opened 6 months ago

Avtober commented 6 months ago

Hi,

I have made some rarefaction curves for my sequence reads but I have one sample with a huge number of reads that is making it hard to read. How can I cut of the x axis at a lower number of reads so that I can better see the other samples? I used the following code:

source("https://raw.githubusercontent.com/mahendra-mariadassou/phyloseq-extended/master/load-extra-functions.R")

Nam.rcurve <- ggrare(Namdata.platy2, step = 500, color = "genus", plot = T, parallel = T, se = F) Nam.rcurve <- Nam.rcurve + facet_wrap(~ genus ) + geom_vline(xintercept = min(sample_sums(Namdata.platy2)), color = "gray60") plot(Nam.rcurve)

image

Many thanks Anya

ycl6 commented 6 months ago

Hi @Avtober I think you can use coord_cartesian() to limit the x and/or y axes if your plot is a ggplot object.

https://ggplot2.tidyverse.org/reference/coord_cartesian.html

Although, I do have to point out that you are using ggrare(), which is a function not part of the phyloseq package. You should raise the issue with the developer of ggrare function.