8000 Merge v2.x into master by jenshnielsen · Pull Request #6246 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Merge v2.x into master #6246

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

Merged
merged 28 commits into from
Mar 30, 2016
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
605a8af
ENH: add XKCD colorname -> hex mapping
tacaswell Dec 31, 2015
010be02
MNT: normalize X11/CSS/HTML colors
tacaswell Jan 2, 2016
e392d03
MNT: normalize to use un-spaced names in XKCD map
tacaswell Jan 2, 2016
e049a49
MNT: unify string handling
tacaswell Jan 2, 2016
bda202b
MNT: always validate alpha as [0, 1] or None
tacaswell Jan 2, 2016
b2543f6
MNT: add xkcd prefix + switch priority order
tacaswell Jan 5, 2016
9feeb9e
FIX: restore single character colors to rgb tuples
tacaswell Jan 18, 2016
3d4a517
DOC: remove last paypal link
tacaswell Feb 8, 2016
b93bd5d
WIP color docs
tacaswell Feb 14, 2016
db5ef16
Update LICENSE file to match doc/users/license.rst
mdboom Mar 2, 2016
80a8e53
DOC: remove static images
tacaswell Feb 8, 2016
f3d4415
DOC/MNT: remove unused/outdate files
tacaswell Mar 7, 2016
9963cca
FIX: use lowercase in map
tacaswell Mar 7, 2016
fafa36f
DOC: string -> color mappings
tacaswell Mar 7, 2016
20db6a0
Merge pull request #6124 from estan/qt5-example-fixes
tacaswell Mar 7, 2016
7c4eb6b
Fixed year issues
mdboom Mar 7, 2016
1bd80a2
Merge pull request #6098 from mdboom/license-update
tacaswell Mar 7, 2016
d74eca5
Merge pull request #6194 from story645/patch-1
tacaswell Mar 21, 2016
e277f99
Merge pull request #6195 from story645/patch-2
tacaswell Mar 21, 2016
40cfef1
Merge pull request #6205 from mdboom/fix-stringio
tacaswell Mar 26, 2016
9687f65
TST: add smoke test for the color blue
tacaswell Mar 28, 2016
9655f45
Merge pull request #5775 from tacaswell/enh_xkcd_colors
jenshnielsen Mar 29, 2016
e981e1e
Merge pull request #6178 from mdboom/macagg
efiring Mar 28, 2016
3a944a6
Merge pull request #6238 from jenshnielsen/fixsphinx140issues
tacaswell Mar 30, 2016
bf82d92
Merge pull request #5973 from tacaswell/doc_update_donation
jenshnielsen Mar 30, 2016
860fdfe
Merge pull request #6244 from matplotlib/v1.5.1-doc
jenshnielsen Mar 30, 2016
9e1668b
Merge pull request #6245 from matplotlib/v1.5.x
jenshnielsen Mar 30, 2016
6461814
Merge remote-tracking branch 'matplotlib/v2.x' into mergev2.xmaster
jenshnielsen Mar 30, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions doc/users/beginner.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ Beginner's Guide
legend_guide.rst
annotations_guide.rst
screenshots.rst
colors.rst
colormaps.rst
colormapnorms.rst



71 changes: 71 additions & 0 deletions doc/users/colors.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.. _colors:

*****************
Specifying Colors
*****************

In almost all places in matplotlib where a color can be specified by the user it can be provided as:

* ``(r, g, b)`` tuples
* ``(r, g, b, a)`` tuples
* hex string, ex ``#OFOFOF``
* float value between [0, 1] for gray level
* One of ``{'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'}``
* valid css4/X11 color names
* valid name from the `XKCD color survey
<http://blog.xkcd.com/2010/05/03/color-survey-results/>`__ These
names are available both with and with out spaces. In the case of name clashes
the css/X11 names have priority. To ensure colors
from the XKCD mapping are used prefix the space-less name with
``'XKCD'``.

All string specifications of color are case-insensitive.

Internally, mpl is moving to storing all colors as RGBA float quadruples.

Name clash between CSS4/X11 and XKCD
------------------------------------

The color names in the XKCD survey include spaces (unlike css4/X11
names). Matplotlib exposes all of the XKCD colors both with and
without spaces.

There are 95 (out of 148 colors in the css color list) conflicts
between the css4/X11 names and the XKCD names. Given that these are
the standard color names of the web, matplotlib should follow these
conventions. To accesses the XKCD colors which are shadowed by css4,
prefix the colorname with ``'XKCD'``, for example ``'blue'`` maps to
``'#0000FF'`` where as ``'XKCDblue'`` maps to ``'#0343DF'``.

.. plot::

import matplotlib.pyplot as plt
import matplotlib._color_data as mcd

import matplotlib.patches as mpatch
overlap = (set(mcd.CSS4_COLORS) & set(mcd.XKCD_COLORS))

fig = plt.figure(figsize=[4.8, 16])
ax = fig.add_axes([0, 0, 1, 1])

j = 0

for n in sorted(overlap, reverse=True):
cn = mcd.CSS4_COLORS[n]
xkcd = mcd.XKCD_COLORS[n].upper()
if cn != xkcd:
print (n, cn, xkcd)

r1 = mpatch.Rectangle((0, j), 1, 1, color=cn)
r2 = mpatch.Rectangle((1, j), 1, 1, color=xkcd)
txt = ax.text(2, j+.5, ' ' + n, va='center', fontsize=10)
ax.add_patch(r1)
ax.add_patch(r2)
ax.axhline(j, color='k')
j += 1

ax.text(.5, j+.1, 'X11', ha='center')
ax.text(1.5, j+.1, 'XKCD', ha='center')
ax.set_xlim(0, 3)
ax.set_ylim(0, j + 1)
ax.axis('off')
5 changes: 1 addition & 4 deletions doc/users/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ User's Guide
configuration.rst
beginner.rst
developer.rst
colors.rst
whats_new.rst
github_stats.rst
license.rst
credits.rst




Loading
0