Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choosing subsets from palette #32

Open
oddmentations opened this issue May 1, 2018 · 3 comments
Open

Choosing subsets from palette #32

oddmentations opened this issue May 1, 2018 · 3 comments

Comments

@oddmentations
Copy link

oddmentations commented May 1, 2018

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
Copy link
Owner

karthik commented May 1, 2018

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
Copy link

kbroman commented May 1, 2018

@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
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants