You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when you use this method you'll run into trouble if your number of needed colors is greater than the length of your color vector. This can be especially problematic because you generally want to just say "always use my company colors so I don't worry about it."
But the downside to this is you still need to keep track of how many colors you need.
This seems like something that could be added to ggplot2 without breaking anything! One solution would be to let scale_fill_manual take a function which takes an integer as an input and returned the desired number of colors (rather than just a vector of colors). This feels similar to how some of the labels and breaks parameters work for scales. You could include the "make_color_vector" function within ggplot2 itself, or leave other people to make their own. Improving this functionality seems like it would help other packages downstream (like ggthemr, which sets default themes but breaks if your custom theme doesn't have enough colors).
I'm happy to help write the code to do this, but unfortunately I'm struggling to figure out where in the ggplot2 code base I would make these changes.
Thank you!
The text was updated successfully, but these errors were encountered:
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/
lockbot
locked and limited conversation to collaborators
Jul 28, 2018
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When you make a chart that uses many discrete colors, you never have to worry about the number of colors if you use the default colors.
If you want to use your own colors (for instance, if you have company colors), it's easy to use a scale_manual to set the colors
However, when you use this method you'll run into trouble if your number of needed colors is greater than the length of your color vector. This can be especially problematic because you generally want to just say "always use my company colors so I don't worry about it."
One solution to this is to create a function that makes a desired length vector of colors based on your existing ones:
But the downside to this is you still need to keep track of how many colors you need.
This seems like something that could be added to ggplot2 without breaking anything! One solution would be to let scale_fill_manual take a function which takes an integer as an input and returned the desired number of colors (rather than just a vector of colors). This feels similar to how some of the labels and breaks parameters work for scales. You could include the "make_color_vector" function within ggplot2 itself, or leave other people to make their own. Improving this functionality seems like it would help other packages downstream (like ggthemr, which sets default themes but breaks if your custom theme doesn't have enough colors).
I'm happy to help write the code to do this, but unfortunately I'm struggling to figure out where in the ggplot2 code base I would make these changes.
Thank you!
The text was updated successfully, but these errors were encountered: