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
If I understand current behavior correctly, the values vector in a scale function is matched by name if there are (any) names and by position otherwise. Would you consider matching by names when the name is present and by position among unnamed items when the name isn't there?
The idea is that this would use blue and pink for male and female, but use navy, red, green, purple for other levels. In the context of a given document, one could expand this to fix colors for levels that will occur in many contexts but still make it possible to plot other data without having to keep changing/specifying the scale function.
Of course, this idea should work for other things (like fill, size, alpha, etc.) as well.
PS. Redefining scale_colour_discrete() like this should really be documented somewhere.
The text was updated successfully, but these errors were encountered:
I like the idea, but I'm unlikely to have the time to implement it. But if you could figure out how to implement the matching bit, I can slot it into the right place:
If I understand current behavior correctly, the values vector in a scale function is matched by name if there are (any) names and by position otherwise. Would you consider matching by names when the name is present and by position among unnamed items when the name isn't there?
I'm imagining a use case like this:
The idea is that this would use blue and pink for male and female, but use navy, red, green, purple for other levels. In the context of a given document, one could expand this to fix colors for levels that will occur in many contexts but still make it possible to plot other data without having to keep changing/specifying the scale function.
Of course, this idea should work for other things (like fill, size, alpha, etc.) as well.
PS. Redefining
scale_colour_discrete()
like this should really be documented somewhere.The text was updated successfully, but these errors were encountered: