Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 73a23f7

Browse filesBrowse files
authored
Merge pull request matplotlib#7046 from efiring/user_color_doc_tweak
DOC: edits to users/colors.rst
2 parents 3297e37 + b9495ad commit 73a23f7
Copy full SHA for 73a23f7

File tree

Expand file treeCollapse file tree

1 file changed

+12
-11
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-11
lines changed

‎doc/users/colors.rst

Copy file name to clipboardExpand all lines: doc/users/colors.rst
+12-11Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ Specifying Colors
77
In almost all places in matplotlib where a color can be specified by the user
88
it can be provided as:
99

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'``)
1415
* one of ``{'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'}``
1516
* a X11/CSS4 color name
1617
* 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
3031

3132
The single digit is the index into the default property cycle
3233
(``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,
3536

3637
.. plot::
3738
:include-source: True
@@ -55,7 +56,7 @@ artist is created. For example
5556
demo('seaborn')
5657

5758
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']``.
5960

6061

6162
xkcd v X11/CSS4
@@ -65,15 +66,15 @@ The xkcd colors are derived from a user survey conducted by the
6566
webcomic xkcd. `Details of the survey are available on the xkcd blog
6667
<https://blog.xkcd.com/2010/05/03/color-survey-results/>`__.
6768

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
6970
between the X11/CSS4 names and the xkcd names, all but 3 of which have
7071
different hex values. For example ``'blue'`` maps to ``'#0000FF'``
7172
where as ``'xkcd:blue'`` maps to ``'#0343DF'``. Due to these name
7273
collisions all of the xkcd colors have ``'xkcd:'`` prefixed. As noted in
7374
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.
7576

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
7778
where the hex values agree are shown in bold.
7879

7980

@@ -94,7 +95,7 @@ where the hex values agree are shown in bold.
9495
cn = mcd.CSS4_COLORS[n]
9596
xkcd = mcd.XKCD_COLORS["xkcd:" + n].upper()
9697
if cn == xkcd:
97-
weight = 'bold'
98+
weight = 'bold'
9899

99100
r1 = mpatch.Rectangle((0, j), 1, 1, color=cn)
100101
r2 = mpatch.Rectangle((1, j), 1, 1, color=xkcd)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.