-
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
Manual scales for specific levels only #2627
Comments
I would speak out against this proposal. It will lead to some really ugly plots. Picking colors that work well with an existing color scale is even more difficult than just creating an entire color scale from scratch, so whoever would use this functionality would unlikely have the skills to actually pick appropriate colors. If somebody wants to implement this in an extension package they are free to do so. But even there, I think what would be needed is a highlight scale that allows the user to define the highlighted categories and then picks all the colors, both highlighted and not. |
I built an extension package as @clauswilke suggested. In case someone else is interested: https://github.com/Freguglia/ggfocus |
@Freguglia I think this is a good idea. I would encourage you, however, to think whether you can implement this within the regular grammar rather than providing a special function that wraps the entire plot. Is there any reason why you can't simply write a |
Yes, I do agree that the regular grammar would be a better option. I was first trying to implement In short, the function wraps the entire plot because I can't figure out how to (a) create the color scale without the complete list of levels or (b) access the data from the function without having the plot as an argument. But I will think more about it to see if I can figure out a solution with the regular grammar. |
You may have to reimplement the Lines 40 to 57 in 1f9ef73
|
@clauswilke Do you think creating a new class, If built appropriately, the regular grammar would work, as calling a |
You should probably coordinate with @yutannihilation's gghighlight: |
In this approach, you may find |
Closing, since development seems to be happening in an extension package. |
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
As an example:
This piece of code works fine, but let's say I want to have
pink
color forversicolor
and I really don't care what color is picked for the others. There could be some kind of "auto-completion" for manual scales so that when I try something like the code below, the levels I don't care about have their color value automatically picked (possibly with a warning). Right now an incomplete manual color scale throws an error. This might be specially useful if (a) you're too lazy to type too many color names you don't really care or (b) the number of levels may vary but there is always one you're most interested in.The text was updated successfully, but these errors were encountered: