Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 834ae93

Browse files
authored
Merge pull request #17881 from meeseeksmachine/auto-backport-of-pr-17871-on-v3.3.x
Backport PR #17871 on branch v3.3.x (Mention single char colors shading in more places)
2 parents c1d3210 + b31a7ba commit 834ae93

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

examples/color/color_demo.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,27 @@
66
Matplotlib recognizes the following formats to specify a color:
77
88
1) an RGB or RGBA tuple of float values in ``[0, 1]`` (e.g. ``(0.1, 0.2, 0.5)``
9-
or ``(0.1, 0.2, 0.5, 0.3)``). RGBA is short for Red, Green, Blue, Alpha;
9+
or ``(0.1, 0.2, 0.5, 0.3)``). RGBA is short for Red, Green, Blue, Alpha;
1010
2) a hex RGB or RGBA string (e.g., ``'#0F0F0F'`` or ``'#0F0F0F0F'``);
11-
3) a string representation of a float value in ``[0, 1]`` inclusive for gray
11+
3) a shorthand hex RGB or RGBA string, equivalent to the hex RGB or RGBA
12+
string obtained by duplicating each character, (e.g., ``'#abc'``, equivalent
13+
to ``'#aabbcc'``, or ``'#abcd'``, equivalent to ``'#aabbccdd'``);
14+
4) a string representation of a float value in ``[0, 1]`` inclusive for gray
1215
level (e.g., ``'0.5'``);
13-
4) a single letter string, i.e. one of
14-
``{'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'}``;
15-
5) a X11/CSS4 ("html") color name, e.g. ``"blue"``;
16-
6) a name from the `xkcd color survey <https://xkcd.com/color/rgb/>`__,
16+
5) a single letter string, i.e. one of
17+
``{'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'}``, which are short-hand notations
18+
for shades of blue, green, red, cyan, magenta, yellow, black, and white;
19+
6) a X11/CSS4 ("html") color name, e.g. ``"blue"``;
20+
7) a name from the `xkcd color survey <https://xkcd.com/color/rgb/>`__,
1721
prefixed with ``'xkcd:'`` (e.g., ``'xkcd:sky blue'``);
18-
7) a "Cn" color spec, i.e. ``'C'`` followed by a number, which is an index into
22+
8) a "Cn" color spec, i.e. ``'C'`` followed by a number, which is an index into
1923
the default property cycle (:rc:`axes.prop_cycle`); the indexing is intended
2024
to occur at rendering time, and defaults to black if the cycle does not
2125
include color.
22-
8) one of ``{'tab:blue', 'tab:orange', 'tab:green',
23-
'tab:red', 'tab:purple', 'tab:brown', 'tab:pink',
24-
'tab:gray', 'tab:olive', 'tab:cyan'}`` which are the Tableau Colors from the
25-
'tab10' categorical palette (which is the default color cycle);
26+
9) one of ``{'tab:blue', 'tab:orange', 'tab:green', 'tab:red', 'tab:purple',
27+
'tab:brown', 'tab:pink', 'tab:gray', 'tab:olive', 'tab:cyan'}`` which are
28+
the Tableau Colors from the 'tab10' categorical palette (which is the
29+
default color cycle);
2630
2731
For more information on colors in matplotlib see
2832

lib/matplotlib/colors.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@
4444
case-insensitive);
4545
* a string representation of a float value in ``[0, 1]`` inclusive for gray
4646
level (e.g., ``'0.5'``);
47-
* one of ``{'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'}``, they are the single
48-
character short-hand notations for blue, green, red, cyan, magenta, yellow,
49-
black, and white.
47+
* one of the characters ``{'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'}``, which
48+
are short-hand notations for shades of blue, green, red, cyan, magenta,
49+
yellow, black, and white. Note that the colors ``'g', 'c', 'm', 'y'`` do not
50+
coincide with the X11/CSS4 colors. Their particular shades were chosen for
51+
better visibility of colored lines against typical backgrounds.
5052
* a X11/CSS4 color name (case-insensitive);
5153
* a name from the `xkcd color survey`_, prefixed with ``'xkcd:'`` (e.g.,
5254
``'xkcd:sky blue'``; case insensitive);

0 commit comments

Comments
 (0)