This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Find R color reference for colors in a palette?

I have a palette in ggplot that I like (eg PuOr) but I want to find the individual colors that it calls when it runs (eg on 8 variables)?

My issue is when I run this, coloring by variable (I have 8 different categories), it will have instances of each of those 8 for the full dataset. But a small subset by chance will only have 3 or 4 of those variables but I want to keep the colors the same for the subset plots as the full plot. I can hack this I think if I know the color codes that PuOr calls but cannot find this out.

r ggplot plots colors

1 answer

See the diverging palette in RColorBrewer.

Brilliant. brewer.pal(8, "PuOr") appears to have worked! Many thanks!

Log in to answer this question.