-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Color cycle handling #6291
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
Color cycle handling #6291
Conversation
@@ -11,6 +11,9 @@ | |||
4) as a string representing a floating point number | |||
from 0 to 1, corresponding to shades of gray. | |||
|
|||
5) as a special color "Cn", where n is a number 0-9 specifying the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence above should be updated to say 5 ways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for noticing. Done.
I assume the test image was not intended to have changed colours. |
Indeed it was intentional. That test is testing a linestyle-only color cycle. Since it has no colors, it defaults to black, which is a more sensible default than the old blue. |
if rcParams['_internal.classic_mode']: | ||
c = 'b' # The original default | ||
else: | ||
c = self._get_patches_for_fill.get_next_color() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am +.75 on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vs. c = 'C0'
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that is the only other plausibly defensible position.
My only reservation is that we have pushed back on this suggestion for so long and that in most cases if you are not mapping the color you probably want to be using plot(x, y, 'o')
instead.
That said, I have no real protest with this.
@@ -867,7 +867,7 @@ def validate_animation_writer_path(p): | |||
## patch props | |||
'patch.linewidth': [None, validate_float_or_None], # line width in points | |||
'patch.edgecolor': ['k', validate_color], # black | |||
'patch.facecolor': ['#1f77b4', validate_color], # blue (first color in color cycle) | |||
'patch.facecolor': ['C0', validate_color], # blue (first color in color cycle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete blue in the comment here?
This is related to #6328. |
backported to v2.x as e524354 |
Replaces #5674.
This uses the color cycle in more places.
It also introduces
Cn
syntax for colors to directly address the Nth element in a color cycle. This was chosen over the[n]
syntax in #5674 because it makes it more obvious that it's color-specific and can only be used in places where colors can be used.