r - get list of colors used in a ggplot2 plot? -
possible duplicate:
how extract fill colours ggplot object?
in arbitrary ggplot plot,
p <- ggplot(data=plantgrowth, aes(x=group, y=weight, fill=group)) + geom_boxplot() is there way extract code of colors used (i.e. variable named "values" modify command
p + scale_fill_manual(values=c("#999999", "#e69f00", "#56b4e9")) ) ?
i colors used in order modify one.
thank you,
françois
for discrete scale (with default setting scale_colour_hue) function hue_pal in package scales used. e.g., 3 factor levels:
r> library(scales) r> scales::hue_pal()(3) [1] "#f8766d" "#00ba38" "#619cff"
Comments
Post a Comment