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

Skip to content

Commit 6e3a6ae

Browse files
committed
change spectral to nipy_spectral, leave spectral as alias, update docs
1 parent 2b5521d commit 6e3a6ae

2 files changed

Lines changed: 49 additions & 41 deletions

File tree

lib/matplotlib/_cm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Nothing here but dictionaries for generating LinearSegmentedColormaps,
33
and a dictionary of these dictionaries.
44
5+
Documentation for each is in pyplot.colormaps()
56
"""
67

78
from __future__ import print_function
@@ -342,7 +343,7 @@ def gfunc32(x):
342343
'green': ((0., 0., 0.),(1.0, 1.0, 1.0)),
343344
'blue': ((0., 1., 1.),(1.0, 0.5, 0.5))}
344345

345-
_spectral_data = {'red': [(0.0, 0.0, 0.0), (0.05, 0.4667, 0.4667),
346+
_nipy_spectral_data = {'red': [(0.0, 0.0, 0.0), (0.05, 0.4667, 0.4667),
346347
(0.10, 0.5333, 0.5333), (0.15, 0.0, 0.0),
347348
(0.20, 0.0, 0.0), (0.25, 0.0, 0.0),
348349
(0.30, 0.0, 0.0), (0.35, 0.0, 0.0),
@@ -1790,7 +1791,8 @@ def gfunc32(x):
17901791
'summer': _summer_data,
17911792
'terrain': _terrain_data,
17921793
'winter': _winter_data,
1793-
'spectral': _spectral_data
1794+
'nipy_spectral': _nipy_spectral_data,
1795+
'spectral': _nipy_spectral_data, # alias for backward compatibility
17941796
}
17951797

17961798

lib/matplotlib/pyplot.py

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,8 +1716,8 @@ def colormaps():
17161716
for nominal data that has no inherent ordering, where color is used
17171717
only to distinguish categories
17181718
1719-
The base colormaps are (with the exception of `spectral`) derived from
1720-
those of the same name provided with Matlab:
1719+
The base colormaps are derived from those of the same name provided
1720+
with Matlab:
17211721
17221722
========= =======================================================
17231723
Colormap Description
@@ -1838,52 +1838,53 @@ def colormaps():
18381838
18391839
Other miscellaneous schemes:
18401840
1841-
========= =======================================================
1842-
Colormap Description
1843-
========= =======================================================
1844-
afmhot sequential black-orange-yellow-white blackbody
1845-
spectrum, commonly used in atomic force microscopy
1846-
brg blue-red-green
1847-
bwr diverging blue-white-red
1848-
coolwarm diverging blue-gray-red, meant to avoid issues with 3D
1849-
shading, color blindness, and ordering of colors [#]_
1850-
CMRmap "Default colormaps on color images often reproduce to
1851-
confusing grayscale images. The proposed colormap
1852-
maintains an aesthetically pleasing color image that
1853-
automatically reproduces to a monotonic grayscale with
1854-
discrete, quantifiable saturation levels." [#]_
1855-
cubehelix Unlike most other color schemes cubehelix was designed
1856-
by D.A. Green to be monotonically increasing in terms
1857-
of perceived brightness. Also, when printed on a black
1858-
and white postscript printer, the scheme results in a
1859-
greyscale with monotonically increasing brightness.
1860-
This color scheme is named cubehelix because the r,g,b
1861-
values produced can be visualised as a squashed helix
1862-
around the diagonal in the r,g,b color cube.
1863-
gnuplot gnuplot's traditional pm3d scheme
1864-
(black-blue-red-yellow)
1865-
gnuplot2 sequential color printable as gray
1866-
(black-blue-violet-yellow-white)
1867-
ocean green-blue-white
1868-
rainbow spectral purple-blue-green-yellow-orange-red colormap
1869-
with diverging luminance
1870-
seismic diverging blue-white-red
1871-
nipy_spectral black-purple-blue-green-yellow-red-white spectrum, originally from the Neuroimaging in Python project
1872-
terrain mapmaker's colors, blue-green-yellow-brown-white,
1873-
originally from IGOR Pro
1874-
========= =======================================================
1841+
============= =======================================================
1842+
Colormap Description
1843+
============= =======================================================
1844+
afmhot sequential black-orange-yellow-white blackbody
1845+
spectrum, commonly used in atomic force microscopy
1846+
brg blue-red-green
1847+
bwr diverging blue-white-red
1848+
coolwarm diverging blue-gray-red, meant to avoid issues with 3D
1849+
shading, color blindness, and ordering of colors [#]_
1850+
CMRmap "Default colormaps on color images often reproduce to
1851+
confusing grayscale images. The proposed colormap
1852+
maintains an aesthetically pleasing color image that
1853+
automatically reproduces to a monotonic grayscale with
1854+
discrete, quantifiable saturation levels." [#]_
1855+
cubehelix Unlike most other color schemes cubehelix was designed
1856+
by D.A. Green to be monotonically increasing in terms
1857+
of perceived brightness. Also, when printed on a black
1858+
and white postscript printer, the scheme results in a
1859+
greyscale with monotonically increasing brightness.
1860+
This color scheme is named cubehelix because the r,g,b
1861+
values produced can be visualised as a squashed helix
1862+
around the diagonal in the r,g,b color cube.
1863+
gnuplot gnuplot's traditional pm3d scheme
1864+
(black-blue-red-yellow)
1865+
gnuplot2 sequential color printable as gray
1866+
(black-blue-violet-yellow-white)
1867+
ocean green-blue-white
1868+
rainbow spectral purple-blue-green-yellow-orange-red colormap
1869+
with diverging luminance
1870+
seismic diverging blue-white-red
1871+
nipy_spectral black-purple-blue-green-yellow-red-white spectrum,
1872+
originally from the Neuroimaging in Python project
1873+
terrain mapmaker's colors, blue-green-yellow-brown-white,
1874+
originally from IGOR Pro
1875+
============= =======================================================
18751876
18761877
The following colormaps are redundant and may be removed in future
1877-
versions. It's recommended to use *gray* or *gray_r* instead, which
1878-
produce identical output:
1878+
versions. It's recommended to use the names in the descriptions
1879+
instead, which produce identical output:
18791880
18801881
========= =======================================================
18811882
Colormap Description
18821883
========= =======================================================
18831884
gist_gray identical to *gray*
18841885
gist_yarg identical to *gray_r*
18851886
binary identical to *gray_r*
1886-
spectral identical to *nipy_spectral*, which was changed to differentiate from ColorBrewer's Spectral map
1887+
spectral identical to *nipy_spectral* [#]_
18871888
========= =======================================================
18881889
18891890
.. rubric:: Footnotes
@@ -1905,6 +1906,11 @@ def colormaps():
19051906
Color-Scale Images
19061907
<http://www.mathworks.com/matlabcentral/fileexchange/2662-cmrmap-m>`_
19071908
by Carey Rappaport
1909+
1910+
.. [#] Changed to distinguish from ColorBrewer's *Spectral* map.
1911+
:func:`spectral` still works, but
1912+
`set_cmap('nipy_spectral')` is recommended for clarity.
1913+
19081914
19091915
"""
19101916
return sorted(cm.cmap_d.keys())

0 commit comments

Comments
 (0)