karthik / wesanderson

A Wes Anderson color palette for R
Other
1.94k stars 147 forks source link

Choosing subsets from palette #32

Open oddmentations opened 6 years ago

oddmentations commented 6 years ago

I am wondering if there is a way to choose a specific subset from a palette. For example, if I am using GrandBudapest2 and would like to use the first and second color in scale_fill_manual and then use the third and fourth from the same palette in scale_color_manual. Is this possible?

Thank you!

karthik commented 6 years ago

Yes totally doable. You can just subset colors into new palettes and use them as needed. If you need more help, please share a reproducible example.

kbroman commented 6 years ago

@informavorous Try using wes_palettes, which is a list of vectors of colors. Something like this:

library(wesanderson)
gp2 <- wes_palettes$GrandBudapest2

ggplot( .... ) + .... + 
    scale_color_manual(values=gp2[3:4]) + 
    scale_fill_manual(values=gp2[1:2])
oddmentations commented 6 years ago

Thank you!