@@ -7,10 +7,11 @@ Specifying Colors
7
7
In almost all places in matplotlib where a color can be specified by the user
8
8
it can be provided as:
9
9
10
- * a ``(r, g, b) `` tuple
11
- * a ``(r, g, b, a) `` tuple
12
- * a hex RGB or RGBA string (ex ``'#0F0F0F' `` or ``'#0F0F0F0F' ``)
13
- * a float value in ``[0, 1] `` inclusive for gray level
10
+ * an RGB or RGBA tuple of float values in ``[0, 1] ``
11
+ (e.g., ``(0.1, 0.2, 0.5) `` or ``(0.1, 0.2, 0.5, 0.3) ``)
12
+ * a hex RGB or RGBA string (e.g., ``'#0F0F0F' `` or ``'#0F0F0F0F' ``)
13
+ * a string representation of a float value in ``[0, 1] ``
14
+ inclusive for gray level (e.g., ``'0.5' ``)
14
15
* one of ``{'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'} ``
15
16
* a X11/CSS4 color name
16
17
* a name from the `xkcd color survey <https://xkcd.com/color/rgb/ >`__
@@ -30,8 +31,8 @@ can be used as a 'single character color' in format-string to
30
31
31
32
The single digit is the index into the default property cycle
32
33
(``matplotlib.rcParams['axes.prop_cycle'] ``). If the property cycle does not
33
- include ``'color `` then black is returned. The color is evaluated when the
34
- artist is created. For example
34
+ include ``'color' `` then black is returned. The color is evaluated when the
35
+ artist is created. For example,
35
36
36
37
.. plot ::
37
38
:include-source: True
@@ -55,7 +56,7 @@ artist is created. For example
55
56
demo('seaborn')
56
57
57
58
will use the first color for the title and then plot using the second
58
- and third colors of the styles ``mpl.rcParams['axes.prop_cycle'] ``.
59
+ and third colors of each style's ``mpl.rcParams['axes.prop_cycle'] ``.
59
60
60
61
61
62
xkcd v X11/CSS4
@@ -65,15 +66,15 @@ The xkcd colors are derived from a user survey conducted by the
65
66
webcomic xkcd. `Details of the survey are available on the xkcd blog
66
67
<https://blog.xkcd.com/2010/05/03/color-survey-results/> `__.
67
68
68
- There are 95 (out of 148 colors in the css color list) name collisions
69
+ Out of 148 colors in the CSS color list, there are 95 name collisions
69
70
between the X11/CSS4 names and the xkcd names, all but 3 of which have
70
71
different hex values. For example ``'blue' `` maps to ``'#0000FF' ``
71
72
where as ``'xkcd:blue' `` maps to ``'#0343DF' ``. Due to these name
72
73
collisions all of the xkcd colors have ``'xkcd:' `` prefixed. As noted in
73
74
the blog post, while it might be interesting to re-define the X11/CSS4 names
74
- based on such a survey we do not do so unilaterally.
75
+ based on such a survey, we do not do so unilaterally.
75
76
76
- The name collisions are shown in the table below, the color names
77
+ The name collisions are shown in the table below; the color names
77
78
where the hex values agree are shown in bold.
78
79
79
80
@@ -94,7 +95,7 @@ where the hex values agree are shown in bold.
94
95
cn = mcd.CSS4_COLORS[n]
95
96
xkcd = mcd.XKCD_COLORS["xkcd:" + n].upper()
96
97
if cn == xkcd:
97
- weight = 'bold'
98
+ weight = 'bold'
98
99
99
100
r1 = mpatch.Rectangle((0, j), 1, 1, color=cn)
100
101
r2 = mpatch.Rectangle((1, j), 1, 1, color=xkcd)
0 commit comments