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 c708871

Browse filesBrowse files
committed
MAINT deprecated 'spectral' in favor of 'nipy_spectral'
closes #7315
1 parent 3e89069 commit c708871
Copy full SHA for c708871

File tree

Expand file treeCollapse file tree

2 files changed

+17
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+17
-4
lines changed

‎lib/matplotlib/_cm.py

Copy file name to clipboardExpand all lines: lib/matplotlib/_cm.py
+15-2Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from __future__ import (absolute_import, division, print_function,
1010
unicode_literals)
1111

12+
from matplotlib.cbook import warn_deprecated
1213
import numpy as np
1314

1415
_binary_data = {
@@ -1365,7 +1366,19 @@ def gfunc32(x):
13651366
)
13661367

13671368

1368-
datad = {
1369+
class _deprecation_datad(dict):
1370+
def __getitem__(self, key):
1371+
if key == "spectral":
1372+
warn_deprecated(
1373+
"2.0",
1374+
name="spectral",
1375+
alternative="nipy_spectral",
1376+
obj_type="colormap"
1377+
)
1378+
return super(_deprecation_datad, self).__getitem__(key)
1379+
1380+
1381+
datad = _deprecation_datad({
13691382
'afmhot': _afmhot_data,
13701383
'autumn': _autumn_data,
13711384
'bone': _bone_data,
@@ -1394,7 +1407,7 @@ def gfunc32(x):
13941407
'winter': _winter_data,
13951408
'nipy_spectral': _nipy_spectral_data,
13961409
'spectral': _nipy_spectral_data, # alias for backward compatibility
1397-
}
1410+
})
13981411

13991412

14001413
datad['Blues'] = _Blues_data

‎lib/matplotlib/cm.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cm.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
import matplotlib as mpl
1717
import matplotlib.colors as colors
1818
import matplotlib.cbook as cbook
19-
from matplotlib._cm import datad
19+
from matplotlib._cm import datad, _deprecation_datad
2020
from matplotlib._cm import cubehelix
2121
from matplotlib._cm_listed import cmaps as cmaps_listed
2222

23-
cmap_d = dict()
23+
cmap_d = _deprecation_datad()
2424

2525
# reverse all the colormaps.
2626
# reversed colormaps have '_r' appended to the name.

0 commit comments

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