[R] Change colour ggiNEXT plot package iNEXT

William Michels wjm1 @end|ng |rom c@@@co|umb|@@edu
Wed Oct 23 23:23:06 CEST 2019


Apparently, the iNEXT package was first described in an academic paper
published in 2016, although CRAN archives go back to 2015.
http://chao.stat.nthu.edu.tw/wordpress/paper/120_pdf_appendix.pdf
https://cran.r-project.org/src/contrib/Archive/iNEXT/

The vignette below has a section entitled "General Customization"
which talks about color. See the four lines of code I've added to the
vignette's code to get a general idea what to do.
https://cran.r-project.org/web/packages/iNEXT/vignettes/Introduction.html

library(iNEXT)
library(ggplot2)
library(gridExtra)
library(grid)
data("spider")
out <- iNEXT(spider, q=0, datatype="abundance")
g <- ggiNEXT(out, type=1, color.var = "site")
print(g)
g1 <- g + scale_colour_manual(values=c("yellow", "green"))
print(g1)
g2 <- g1 + scale_fill_manual(values=c("yellow", "green"))
print(g2)

HTH, Bill.

W. Michels, Ph.D.




On Wed, Oct 23, 2019 at 11:13 AM David Winsemius <dwinsemius using comcast.net> wrote:
>
>
> On 10/22/19 12:48 PM, Luigi Marongiu wrote:
> > I thought it was a major package for ecological analysis.
>
>
> Yours is the first question in 20 years of Rhelp about the package iNEXT.
>
>
> --
>
> David
>
> > Anyway,
> > thank you for the tips. I'll dip from there.
> >
> > On Tue, Oct 22, 2019 at 5:29 PM Jeff Newmiller <jdnewmil using dcn.davis.ca.us> wrote:
> >> Probably, assuming that function returns a ggplot object. You will need to identify the levels of the factor used for distinguishing groups, and add a scale_colour_manual() to the ggplot object with colors specified in the same order as those levels.
> >>
> >> Support for obscure packages is technically off-topic here ... if you need a more specific answer you may need to correspond with the package authors or use their suggested support resources.
> >>
> >> On October 22, 2019 2:18:49 AM PDT, Luigi Marongiu <marongiu.luigi using gmail.com> wrote:
> >>> Dear all,
> >>> is it possible to provide custom color to the rarefaction curve of the
> >>> package iNEXT (ggiNEXT)?
> >>> If I have these data:
> >>> ```
> >>> library(iNEXT)
> >>> library(ggplot2)
> >>> data(spider)
> >>> out <- iNEXT(spider, q=0, datatype="abundance")
> >>> ggiNEXT(out, type=1)
> >>> ```
> >>> can i colour the lines with, let's say, yellow and green?
> >>> Thank you
> >> --
> >> Sent from my phone. Please excuse my brevity.
> >
> >
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list