0

I am trying to match the aesthetics of ggiNEXT objects in a series of manually generated ggplot2 figures. Sample figure is below, where colors of lines and 95% confidence intervals are those chosen by default by function ggiNEXT (code taken directly from function help):

library(iNEXT)
library(ggplot2)
z <- iNEXT(spider, q=c(0,1,2), datatype="abundance")
ggiNEXT(z, facet.var="Assemblage", color.var="Order.q")

Sample ggiNEXT plot

I want to determine what colors are used by default for lines and 95% confidence intervals - how can I figure this out?

stefan
  • 90,330
  • 6
  • 25
  • 51
overcup
  • 117
  • 7

1 Answers1

0

Function ggplot_build() in package ggplot2 can be used to extract colors.

> palette_extract <- ggplot_build( ggiNEXT(z, facet.var="Assemblage", color.var="Order.q") )
> as.vector(unique(palette_extract$data[[1]][1]))
$colour
[1] "#D55E00" "#0072B2" "#CC79A7"
overcup
  • 117
  • 7