8000 MAINT deprecated spectral function as well · matplotlib/matplotlib@5de2f95 · GitHub
[go: up one dir, main page]

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 5de2f95

Browse files
committed
MAINT deprecated spectral function as well
1 parent c5738e2 commit 5de2f95

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

boilerplate.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff 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

91112
def 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()'

0 commit comments

Comments
 (0)
0