Find R color reference for colors in a palette?
1
0
Entering edit mode
7.7 years ago
james.lloyd ▴ 100

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.9k views
ADD COMMENT
1
Entering edit mode
7.7 years ago

See the diverging palette in RColorBrewer.

ADD COMMENT
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 2481 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6