Skip to content

Could the NA value be set via the theme in addition to the palette itself? #6337

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

Closed
davidhodge931 opened this issue Feb 18, 2025 · 3 comments

Comments

@davidhodge931
Copy link

I noticed that with the new version you'll be able to set the palette via the theme - very cool!

I was wondering if the NA values for these could also be set?

For example..

set_theme(
     theme_grey() + 
     theme(
          palette.colour.discrete = c("red", "blue", "green"), 
          palette.colour.discrete.na = "lightgrey",
     ) 
@teunbrand
Copy link
Collaborator

Thanks for noticing! I'm afraid if we're going to allow this, the next question would be 'can we set the limits via the theme?', thereafter 'how about breaks, labels?' etc. (or requests for binned palettes for that matter) I'm not entirely comfortable with scope creep at this point. I think the reason why I'm uncomfortable with this is what default palette you use is not really a data-driven choice so it fits in the theme that way. How missing data is represented is a more data-driven choice, so that doesn't seem appropriate to set in a theme. In any case, if you want to set na.value without committing to a type of scale, you might also be interested in #6196.

@davidhodge931
Copy link
Author

Whoa #6196 is super cool - didn't know about this. It still doesn't allow me to set this though for all plots that follow?

I want to set as much stuff as makes sense to up-front. I think the NA colour is in the same boat as the colour palette. But granted, of much lower importance.

Feel free to close if you think

@teunbrand
Copy link
Collaborator

Feel free to close if you think

I'm going to take you up on that offer :)

@teunbrand teunbrand closed this as not planned Won't fix, can't repro, duplicate, stale Feb 19, 2025
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

2 participants