-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Support Cn colors with n>=10. #12598
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
``Cn`` colors now support ``n>=10`` | ||
``````````````````````````````````` | ||
|
||
It is now possible to go beyond the tenth color in the property cycle using | ||
``Cn`` syntax, e.g. ``plt.plot([1, 2], color="C11")`` now uses the 12th color | ||
in the cycle. | ||
|
||
Note that previously, a construct such as ``plt.plot([1, 2], "C11")`` would be | ||
interpreted as a request to use color ``C1`` and marker ``1`` (an "inverted Y"). | ||
To obtain such a plot, one should now use ``plt.plot([1, 2], "1C1")`` (so that | ||
the first "1" gets correctly interpreted as a marker specification), or, more | ||
explicitly, ``plt.plot([1, 2], marker="1", color="C1")``. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1517,32 +1517,14 @@ def plot(self, *args, scalex=True, scaley=True, **kwargs): | |
|
||
A format string consists of a part for color, marker and line:: | ||
|
||
fmt = '[color][marker][line]' | ||
fmt = '[marker][line][color]' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure it is worth to make that change. Anyway we should explicitly state that order does not matter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, it does in the sense that C11 doesn't mean the same thing as 1C1. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel that 'b-' is much more used in practical code than '-b'. Maybe also because of the current docs. I wouldn't want to change the habits of users for that. 'C11' really an edge case, and is just now eagerly collecting digits. People can still go for '1C1' in that specific case (or use kwargs), I would not generally recommend switching the order. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not recommanding it (or even coming closing to thinking about deprecating the other order); I'm just putting the docs in the order that always works... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two options:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Done.
That was already done. |
||
|
||
Each of them is optional. If not provided, the value from the style | ||
cycle is used. Exception: If ``line`` is given, but no ``marker``, | ||
the data will be a line without markers. | ||
|
||
**Colors** | ||
|
||
The following color abbreviations are supported: | ||
|
||
============= =============================== | ||
character color | ||
============= =============================== | ||
``'b'`` blue | ||
``'g'`` green | ||
``'r'`` red | ||
``'c'`` cyan | ||
``'m'`` magenta | ||
``'y'`` yellow | ||
``'k'`` black | ||
``'w'`` white | ||
============= =============================== | ||
|
||
If the color is the only part of the format string, you can | ||
additionally use any `matplotlib.colors` spec, e.g. full names | ||
(``'green'``) or hex strings (``'#008000'``). | ||
Other combinations such as ``[color][marker][line]`` are also | ||
supported, but note that their parsing may be ambiguous. | ||
|
||
**Markers** | ||
|
||
|
@@ -1587,11 +1569,33 @@ def plot(self, *args, scalex=True, scaley=True, **kwargs): | |
Example format strings:: | ||
|
||
'b' # blue markers with default shape | ||
'ro' # red circles | ||
'g-' # green solid line | ||
'or' # red circles | ||
'-g' # green solid line | ||
'--' # dashed line with default color | ||
'k^:' # black triangle_up markers connected by a dotted line | ||
'^k:' # black triangle_up markers connected by a dotted line | ||
|
||
**Colors** | ||
|
||
The supported color abbreviations are the single letter codes | ||
|
||
============= =============================== | ||
character color | ||
============= =============================== | ||
``'b'`` blue | ||
``'g'`` green | ||
``'r'`` red | ||
``'c'`` cyan | ||
``'m'`` magenta | ||
``'y'`` yellow | ||
``'k'`` black | ||
``'w'`` white | ||
============= =============================== | ||
|
||
and the ``'CN'`` colors that index into the default property cycle. | ||
|
||
If the color is the only part of the format string, you can | ||
additionally use any `matplotlib.colors` spec, e.g. full names | ||
(``'green'``) or hex strings (``'#008000'``). | ||
""" | ||
lines = [] | ||
|
||
|
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.
Are there any gallary examples that need to be updated to show 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.
A quick grep doesn't yield anything relevant.