Skip to content
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

Merged
merged 8 commits into from
Apr 28, 2016
Merged

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Apr 11, 2016

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.

@mdboom mdboom added this to the 2.0 (style change major release) milestone Apr 11, 2016
@@ -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
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing. Done.

@QuLogic
Copy link
Member

QuLogic commented Apr 11, 2016

I assume the test image was not intended to have changed colours.

@mdboom
Copy link
Member Author

mdboom commented Apr 11, 2016

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()
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vs. c = 'C0'?

Copy link
Member

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)
Copy link
Member

@jenshnielsen jenshnielsen Apr 25, 2016

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?

@efiring
Copy link
Member

efiring commented Apr 26, 2016

This is related to #6328.

@tacaswell tacaswell merged commit 8af02b3 into matplotlib:master Apr 28, 2016
@tacaswell
Copy link
Member

backported to v2.x as e524354

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants