Drew Tyre
School of Natural Resources
University of Nebraska-Lincoln
416 Hardin Hall, East Campus
3310 Holdrege Street
Lincoln, NE 68583-0974
phone: +1 402 472 4054
fax: +1 402 472 2946
email: atyre2 at unl.edu
http://snr.unl.edu/tyre
http://drewtyre.rbind.io
The point is that our true nature is not some ideal that we have to live up to. It?s who we are right now, and that?s what we can make friends with and celebrate.
Excerpted from: Awakening Loving-Kindness by Pema Ch?dr?n
?On 12/17/18, 10:14 AM, "R-sig-ecology on behalf of Ellen Pape" <r-sig-ecology-bounces at r-project.org on behalf of ellen.pape at gmail.com> wrote:
Hi all,
As I use ggplot2 for all my graphs, I would like to use ggplot2 to
construct rarefaction curves as well (I also want to combine 2 rarefaction
curves in 1 plot using cowplot which also vows for using ggplot2).
I made these rarefaction curves using the rarecurve function in vegan, but
I don't see how I can use these results and put these in ggplot2.
I found the following website during my search:
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.fromthebottomoftheheap.net_2015_04_16_drawing-2Drarefaction-2Dcurves-2Dwith-2Dcustom-2Dcolours_&d=DwICAg&c=Cu5g146wZdoqVuKpTNsYHeFX_rg6kWhlkLF8Eft-wwo&r=aLEaSryyUcERVqcKVZl7lQ&m=ScKzUcnIZJ2da4_YAAzmizwFy-CbI90_F4SV_FKSLLc&s=-DiwE4s5JljqtJk5ZhKOE4Benr3yDXmDM19K7wNG3bI&e=
but it does not explain how to draw rarefaction curves with ggplot2.
This website mentions - and this is what I would like to be able to do in
ggplot2:
"Where I do think this sort of approach might work is if the samples in the
data set come from a few different groups and we want to colour the curves
by group.
col <- c("darkred", "forestgreen", "hotpink", "blue")set.seed(3)grp <-
factor(sample(seq_along(col), nrow(BCI2), replace = TRUE))cols <-
col[grp]
The code above creates a grouping factor grp for illustration purposes; in
real analyses you'd have this already as a factor variable in you data
somewhere. We also have to expand the col vector because we are plotting
each line in a loop. The plot code, reusing elements from the previous
plot, is shown below:
plot(c(1, max(Nmax)), c(1, max(Smax)), xlab = "Sample Size",
ylab = "Species", type = "n")abline(v = raremax)for (i in seq_along(out)) {
N <- attr(out[[i]], "Subsample")
lines(N, out[[i]], col = cols[i])}
[image: An attempt at rarefaction curves output with custom colours per
groups of curves.]An attempt at rarefaction curves output with custom
colours per groups of curves.
but I don't see how I adjust this code to make the same plot in ggplot2.
Anyone?
Thanks!
Ellen
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
R-sig-ecology at r-project.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Decology&d=DwICAg&c=Cu5g146wZdoqVuKpTNsYHeFX_rg6kWhlkLF8Eft-wwo&r=aLEaSryyUcERVqcKVZl7lQ&m=ScKzUcnIZJ2da4_YAAzmizwFy-CbI90_F4SV_FKSLLc&s=w7PfOR1D2XX19m5JJqRubGPuMylTRoX3JYCpGkFoqnM&e=