File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,6 +87,27 @@ def {name}():
8787
8888"""
8989
90+ CMAP_TEMPLATE_DEPRECATED = AUTOGEN_MSG + """
91+ def {name}():
92+ '''
93+ set the default colormap to {name} and apply to current image if any.
94+ See help(colormaps) for more information
95+ '''
96+ from matplotlib.cbook import warn_deprecated
97+ warn_deprecated(
98+ "2.0",
99+ name="{name}",
100+ obj_type="colormap"
101+ )
102+
103+ rc('image', cmap='{name}')
104+ im = gci()
105+
106+ if im is not None:
107+ im.set_cmap(cm.{name})
108+
109+ """
110+
90111
91112def boilerplate_gen ():
92113 """Generator of lines for the automated part of pyplot."""
@@ -322,16 +343,18 @@ def format_value(value):
322343 'spring' ,
323344 'summer' ,
324345 'winter' ,
325- 'spectral' ,
326-
327346 'magma' ,
328347 'inferno' ,
329348 'plasma' ,
330- 'viridis'
349+ 'viridis' ,
350+ "nipy_spectral"
331351 )
352+ deprecated_cmaps = ("spectral" , )
332353 # add all the colormaps (autumn, hsv, ....)
333354 for name in cmaps :
334355 yield CMAP_TEMPLATE .format (name = name )
356+ for name in deprecated_cmaps :
357+ yield CMAP_TEMPLATE_DEPRECATED .format (name = name )
335358
336359 yield ''
337360 yield '_setup_pyplot_info_docstrings()'
You can’t perform that action at this time.
0 commit comments