Skip to content

Commit 9663522

Browse files
authored
Merge pull request #10926 from anntzer/api-removals
Some more removals of deprecated APIs.
2 parents 5a8f4ea + 4943487 commit 9663522

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

@@ -3162,21 +3155,4 @@ def nipy_spectral():
31623155
"""
31633156
set_cmap("nipy_spectral")
31643157

3165-
3166-
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3167-
def spectral():
3168-
"""
3169-
Set the colormap to "spectral".
3170-
3171-
This changes the default colormap as well as the colormap of the current
3172-
image if there is one. See ``help(colormaps)`` for more information.
3173-
"""
3174-
from matplotlib.cbook import warn_deprecated
3175-
warn_deprecated(
3176-
"2.0",
3177-
name="spectral",
3178-
obj_type="colormap"
3179-
)
3180-
set_cmap("spectral")
3181-
31823158
_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
@@ -67,24 +67,6 @@ def {name}():
6767
6868
'''
6969

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

8971
def boilerplate_gen():
9072
"""Generator of lines for the automated part of pyplot."""
@@ -264,12 +246,9 @@ def __repr__(self):
264246
'viridis',
265247
"nipy_spectral"
266248
)
267-
deprecated_cmaps = ("spectral", )
268249
# add all the colormaps (autumn, hsv, ....)
269250
for name in cmaps:
270251
yield CMAP_TEMPLATE.format(name=name)
271-
for name in deprecated_cmaps:
272-
yield CMAP_TEMPLATE_DEPRECATED.format(name=name)
273252

274253
yield ''
275254
yield '_setup_pyplot_info_docstrings()'

0 commit comments

Comments
 (0)