Skip to content

Commit 4943487

Browse files
committed
Some more removals of deprecated APIs.
Note that plt.spectral already raises an exception as of 2.2 anyways (the underlying colormap has already been removed).
1 parent f7b6f89 commit 4943487

File tree

7 files changed

+3
-83
lines changed

7 files changed

+3
-83
lines changed

doc/api/axes_api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ Property cycle
229229
:nosignatures:
230230

231231
Axes.set_prop_cycle
232-
Axes.set_color_cycle
233232

234233

235234
Axis / limits

doc/api/next_api_changes/2018-02-18-AL-removals.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

doc/api/next_api_changes/2018-02-26-AL-removals.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ The following deprecated API elements have been removed:
1515
``cbook.recursive_remove``, ``cbook.unmasked_index_ranges``,
1616
``cbook.Null``, ``cbook.RingBuffer``, ``cbook.Sorter``, ``cbook.Xlator``,
1717
- ``font_manager.weight_as_number``, ``font_manager.ttfdict_to_fnames``,
18-
- ``pyplot.colors``,
18+
- ``pyplot.colors``, ``pyplot.spectral``,
1919
- ``rcsetup.validate_negative_linestyle``,
2020
``rcsetup.validate_negative_linestyle_legacy``,
2121
- ``testing.compare.verifiers``, ``testing.compare.verify``,
2222
- ``testing.decorators.knownfailureif``,
2323
``testing.decorators.ImageComparisonTest.remove_text``,
2424
- ``tests.assert_str_equal``, ``tests.test_tinypages.file_same``,
2525
- ``texmanager.dvipng_hack_alpha``,
26-
- ``_AxesBase.axesPatch``, ``_AxesBase.get_cursor_props``,
27-
``_AxesBase.set_cursor_props``,
26+
- ``_AxesBase.axesPatch``, ``_AxesBase.set_color_cycle``,
27+
``_AxesBase.get_cursor_props``, ``_AxesBase.set_cursor_props``,
2828
- ``_ImageBase.iterpnames``,
2929
- ``FigureCanvasBase.start_event_loop_default``;
3030
- ``FigureCanvasBase.stop_event_loop_default``;

lib/matplotlib/axes/_base.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,24 +1208,6 @@ def set_prop_cycle(self, *args, **kwargs):
12081208
self._get_lines.set_prop_cycle(prop_cycle)
12091209
self._get_patches_for_fill.set_prop_cycle(prop_cycle)
12101210

1211-
@cbook.deprecated('1.5', alternative='`.set_prop_cycle`')
1212-
def set_color_cycle(self, clist):
1213-
"""
1214-
Set the color cycle for any future plot commands on this Axes.
1215-
1216-
Parameters
1217-
----------
1218-
clist
1219-
A list of mpl color specifiers.
1220-
"""
1221-
if clist is None:
1222-
# Calling set_color_cycle() or set_prop_cycle() with None
1223-
# effectively resets the cycle, but you can't do
1224-
# set_prop_cycle('color', None). So we are special-casing this.
1225-
self.set_prop_cycle(None)
1226-
else:
1227-
self.set_prop_cycle('color', clist)
1228-
12291211
def get_aspect(self):
12301212
return self._aspect
12311213

lib/matplotlib/pyplot.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,7 +2069,6 @@ def colormaps():
20692069
gist_gray identical to *gray*
20702070
gist_yarg identical to *gray_r*
20712071
binary identical to *gray_r*
2072-
spectral identical to *nipy_spectral* [#]_
20732072
========= =======================================================
20742073
20752074
.. rubric:: Footnotes
@@ -2090,12 +2089,6 @@ def colormaps():
20902089
Color-Scale Images
20912090
<https://www.mathworks.com/matlabcentral/fileexchange/2662-cmrmap-m>`_
20922091
by Carey Rappaport
2093-
2094-
.. [#] Changed to distinguish from ColorBrewer's *Spectral* map.
2095-
:func:`spectral` still works, but
2096-
``set_cmap('nipy_spectral')`` is recommended for clarity.
2097-
2098-
20992092
"""
21002093
return sorted(cm.cmap_d)
21012094

@@ -3264,21 +3257,4 @@ def nipy_spectral():
32643257
"""
32653258
set_cmap("nipy_spectral")
32663259

3267-
3268-
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3269-
def spectral():
3270-
"""
3271-
Set the colormap to "spectral".
3272-
3273-
This changes the default colormap as well as the colormap of the current
3274-
image if there is one. See ``help(colormaps)`` for more information.
3275-
"""
3276-
from matplotlib.cbook import warn_deprecated
3277-
warn_deprecated(
3278-
"2.0",
3279-
name="spectral",
3280-
obj_type="colormap"
3281-
)
3282-
set_cmap("spectral")
3283-
32843260
_setup_pyplot_info_docstrings()

lib/matplotlib/tests/test_cycles.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,6 @@ def test_cycle_reset():
181181
got = next(ax._get_lines.prop_cycler)
182182
assert prop == got
183183

184-
fig, ax = plt.subplots()
185-
# Need to double-check the old set/get_color_cycle(), too
186-
with warnings.catch_warnings():
187-
warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
188-
prop = next(ax._get_lines.prop_cycler)
189-
ax.set_color_cycle(['c', 'm', 'y', 'k'])
190-
assert prop != next(ax._get_lines.prop_cycler)
191-
ax.set_color_cycle(None)
192-
got = next(ax._get_lines.prop_cycler)
193-
assert prop == got
194-
195184

196185
def test_invalid_input_forms():
197186
fig, ax = plt.subplots()

tools/boilerplate.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,6 @@ def {name}():
7171
7272
'''
7373

74-
CMAP_TEMPLATE_DEPRECATED = AUTOGEN_MSG + '''
75-
def {name}():
76-
"""
77-
Set the colormap to "{name}".
78-
79-
This changes the default colormap as well as the colormap of the current
80-
image if there is one. See ``help(colormaps)`` for more information.
81-
"""
82-
from matplotlib.cbook import warn_deprecated
83-
warn_deprecated(
84-
"2.0",
85-
name="{name}",
86-
obj_type="colormap"
87-
)
88-
set_cmap("{name}")
89-
90-
'''
91-
9274

9375
def boilerplate_gen():
9476
"""Generator of lines for the automated part of pyplot."""
@@ -308,12 +290,9 @@ def format_value(value):
308290
'viridis',
309291
"nipy_spectral"
310292
)
311-
deprecated_cmaps = ("spectral", )
312293
# add all the colormaps (autumn, hsv, ....)
313294
for name in cmaps:
314295
yield CMAP_TEMPLATE.format(name=name)
315-
for name in deprecated_cmaps:
316-
yield CMAP_TEMPLATE_DEPRECATED.format(name=name)
317296

318297
yield ''
319298
yield '_setup_pyplot_info_docstrings()'

0 commit comments

Comments
 (0)