File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 99from __future__ import (absolute_import , division , print_function ,
1010 unicode_literals )
1111
12+ from matplotlib .cbook import warn_deprecated
1213import 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
14001413datad ['Blues' ] = _Blues_data
Original file line number Diff line number Diff line change 1616import matplotlib as mpl
1717import matplotlib .colors as colors
1818import matplotlib .cbook as cbook
19- from matplotlib ._cm import datad
19+ from matplotlib ._cm import datad , _deprecation_datad
2020from matplotlib ._cm import cubehelix
2121from 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.
You can’t perform that action at this time.
0 commit comments