-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Configurable qualitative color scales #3833
Configurable qualitative color scales #3833
Conversation
ba3d522
to
ab65a7d
Compare
@clauswilke and @cpsievert where are we on this? If we want to have this in 3.3.1 we will need to get this finished off in a way where it is non-breaking (i.e. doesn't default to okabe-ito, but the regular behaviour). I'm fine with having a breaking change in this for the release after that. Should we add the infrastructure in 3.3.1 or just wait for the whole PR until after the patch release? |
I think it's in @cpsievert's court to finish this off. He had indicated a one-line change that would make this non-breaking, but I think this change hasn't been applied yet: https://twitter.com/cpsievert/status/1255585845915955200?s=20 @cpsievert Could you commit this change and resolve the conflicts etc? And I'm still not sure whether this comment (#3826 (comment)) needs further addressing. |
8edbac9
to
8851f7d
Compare
…tOption('ggplot2.discrete.[fill/colour]') argument, closes tidyverse#3826
8851f7d
to
b71d67d
Compare
…instead of codes) all the way down
Ok, this should be ready for a closer look now. Also, @clauswilke, I asked Hadley about that comment you've linked to and he said he can't recall what he was talking about |
4c89293
to
fa89c5d
Compare
Closes #3826 by:
scale_[fill/colour]_discrete()
) through a newtype
argument, which defaults toggplot2.discrete.[fill/colour]
options.type
and using those codes if (and only if) there are more codes than levels. In addition to a character vector, you can also supply a list of vectors totype
and it will choose the minimum length vector that can support the number of levels to encode, which provides a convenient way to switch the default palette based on the number of levels (see examples below).3. Havingtype
default to a colour-blind safe colour palette, such as Okabe-Ito. This will lead to 'breaking' changes, but those who wish to have the old behavior can do:options(ggplot2.discrete.fill = scale_fill_hue, ggplot2.discrete.colour = scale_colour_hue)
(UPDATE: this PR won't change the default, but a future major release likely will)
Examples
options(opts)
Created on 2020-02-24 by the reprex package (v0.3.0)
TODO
scale_[fill/colour]_qualitative()
)