Skip to content

Commit a946ab2

Browse files
committed
Remove miscellaneous deprecations from 3.5
1 parent 113fc77 commit a946ab2

35 files changed

+102
-842
lines changed

doc/api/blocking_input_api.rst

-8
This file was deleted.

doc/api/index.rst

-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ Alphabetical list of modules:
105105
backend_tools_api.rst
106106
index_backend_api.rst
107107
bezier_api.rst
108-
blocking_input_api.rst
109108
category_api.rst
110109
cbook_api.rst
111110
cm_api.rst
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
Miscellaneous removals
2+
~~~~~~~~~~~~~~~~~~~~~~
3+
4+
- ``is_url`` and ``URL_REGEX`` are removed. (They were previously defined in
5+
the toplevel :mod:`matplotlib` module.)
6+
- The ``ArrowStyle.beginarrow`` and ``ArrowStyle.endarrow`` attributes are
7+
removed; use the ``arrow`` attribute to define the desired heads and tails
8+
of the arrow.
9+
- ``backend_pgf.LatexManager.str_cache`` is removed.
10+
- ``backends.qt_compat.ETS`` and ``backends.qt_compat.QT_RC_MAJOR_VERSION`` are
11+
removed, with no replacement.
12+
- The ``blocking_input`` module is removed. Instead, use
13+
``canvas.start_event_loop()`` and ``canvas.stop_event_loop()`` while
14+
connecting event callbacks as needed.
15+
- ``cbook.report_memory`` is removed; use ``psutil.virtual_memory`` instead.
16+
- ``cm.LUTSIZE`` is removed. Use :rc:`image.lut` instead. This value only
17+
affects colormap quantization levels for default colormaps generated at
18+
module import time.
19+
- ``Colorbar.patch`` is removed; this attribute was not correctly updated
20+
anymore.
21+
- ``ContourLabeler.get_label_width`` is removed.
22+
- ``Dvi.baseline`` is removed (with no replacement).
23+
- The *format* parameter of ``dviread.find_tex_file`` is removed (with no
24+
replacement).
25+
- ``FancyArrowPatch.get_path_in_displaycoord`` and
26+
``ConnectionPath.get_path_in_displaycoord`` are removed. The path in
27+
display coordinates can still be obtained, as for other patches, using
28+
``patch.get_transform().transform_path(patch.get_path())``.
29+
- The ``font_manager.win32InstalledFonts`` and
30+
``font_manager.get_fontconfig_fonts`` helper functions are removed.
31+
- All parameters of ``imshow`` starting from *aspect* are keyword-only.
32+
- ``QuadMesh.convert_mesh_to_paths`` and ``QuadMesh.convert_mesh_to_triangles``
33+
are removed. ``QuadMesh.get_paths()`` can be used as an alternative for the
34+
former; there is no replacement for the latter.
35+
- ``ScalarMappable.callbacksSM`` is removed. Use
36+
``ScalarMappable.callbacks`` instead.
37+
- ``streamplot.get_integrator`` is removed.
38+
- ``style.core.STYLE_FILE_PATTERN``, ``style.core.load_base_library``, and
39+
``style.core.iter_user_libraries`` are removed.
40+
- ``SubplotParams.validate`` is removed. Use `.SubplotParams.update` to
41+
change `.SubplotParams` while always keeping it in a valid state.
42+
- The ``grey_arrayd``, ``font_family``, ``font_families``, and ``font_info``
43+
attributes of `.TexManager` are removed.
44+
- ``Text.get_prop_tup`` is removed with no replacements (because the `.Text`
45+
class cannot know whether a backend needs to update cache e.g. when the
46+
text's color changes).
47+
- ``Tick.apply_tickdir`` didn't actually update the tick markers on the
48+
existing Line2D objects used to draw the ticks and is removed; use
49+
`.Axis.set_tick_params` instead.
50+
- ``tight_layout.auto_adjust_subplotpars`` is removed.
51+
- The ``grid_info`` attribute of ``axisartist`` classes has been removed.
52+
- ``axes_grid1.axes_grid.CbarAxes`` and ``axisartist.axes_grid.CbarAxes`` are
53+
removed (they are now dynamically generated based on the owning axes
54+
class).
55+
- The ``axes_grid1.Divider.get_vsize_hsize`` and
56+
``axes_grid1.Grid.get_vsize_hsize`` methods are removed.
57+
- ``AxesDivider.append_axes(..., add_to_figure=False)`` is removed. Use
58+
``ax.remove()`` to remove the Axes from the figure if needed.
59+
- ``FixedAxisArtistHelper.change_tick_coord`` is removed with no
60+
replacement.
61+
- ``floating_axes.GridHelperCurveLinear.get_boundary`` is removed with no
62+
replacement.
63+
- ``ParasiteAxesBase.get_images_artists`` is removed.
64+
- The "units finalize" signal (previously emitted by Axis instances) is
65+
removed. Connect to "units" instead.
66+
- Passing formatting parameters positionally to ``stem()`` is no longer
67+
possible.

doc/api/prev_api_changes/api_changes_0.98.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Changes for 0.98.0
1212
rather than custom callback handling. Any users of
1313
``matplotlib.cm.ScalarMappable.add_observer`` of the
1414
:class:`~matplotlib.cm.ScalarMappable` should use the
15-
:attr:`matplotlib.cm.ScalarMappable.callbacksSM`
15+
``matplotlib.cm.ScalarMappable.callbacksSM``
1616
:class:`~matplotlib.cbook.CallbackRegistry` instead.
1717

1818
* New axes function and Axes method provide control over the plot

doc/api/prev_api_changes/api_changes_1.3.x.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Code changes
192192
by ``self.vline`` for vertical cursors lines and ``self.hline`` is added
193193
for the horizontal cursors lines.
194194

195-
* On POSIX platforms, the :func:`~matplotlib.cbook.report_memory` function
195+
* On POSIX platforms, the ``matplotlib.cbook.report_memory`` function
196196
raises :class:`NotImplementedError` instead of :class:`OSError` if the
197197
:command:`ps` command cannot be run.
198198

doc/api/prev_api_changes/api_changes_3.1.0.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,9 @@ consistent with the behavior on Py2, where a buffer object was
389389
returned.
390390

391391

392-
`matplotlib.font_manager.win32InstalledFonts` return type
393-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
394-
`matplotlib.font_manager.win32InstalledFonts` returns an empty list instead
392+
``matplotlib.font_manager.win32InstalledFonts`` return type
393+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
394+
``matplotlib.font_manager.win32InstalledFonts`` returns an empty list instead
395395
of None if no fonts are found.
396396

397397
``Axes.fmt_xdata`` and ``Axes.fmt_ydata`` error handling

doc/users/explain/interactive_guide.rst

+1-3
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,7 @@ Blocking functions
213213
------------------
214214

215215
If you only need to collect points in an Axes you can use
216-
`.Figure.ginput` or more generally the tools from
217-
`.blocking_input` the tools will take care of starting and stopping
218-
the event loop for you. However if you have written some custom event
216+
`.Figure.ginput`. However if you have written some custom event
219217
handling or are using `.widgets` you will need to manually run the GUI
220218
event loop using the methods described :ref:`above <cp_block_the_prompt>`.
221219

lib/matplotlib/__init__.py

-9
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,6 @@ class __getattr__:
187187
__version__ = property(lambda self: _get_version())
188188
__version_info__ = property(
189189
lambda self: _parse_to_version_info(self.__version__))
190-
# module-level deprecations
191-
URL_REGEX = _api.deprecated("3.5", obj_type="")(property(
192-
lambda self: re.compile(r'^http://|^https://|^ftp://|^file:')))
193190

194191

195192
def _check_versions():
@@ -732,12 +729,6 @@ def rc_params(fail_on_error=False):
732729
return rc_params_from_file(matplotlib_fname(), fail_on_error)
733730

734731

735-
@_api.deprecated("3.5")
736-
def is_url(filename):
737-
"""Return whether *filename* is an http, https, ftp, or file URL path."""
738-
return __getattr__("URL_REGEX").match(filename) is not None
739-
740-
741732
@functools.lru_cache()
742733
def _get_ssl_context():
743734
try:

lib/matplotlib/_tight_layout.py

-42
Original file line numberDiff line numberDiff line change
@@ -157,48 +157,6 @@ def _auto_adjust_subplotpars(
157157
return kwargs
158158

159159

160-
@_api.deprecated("3.5")
161-
def auto_adjust_subplotpars(
162-
fig, renderer, nrows_ncols, num1num2_list, subplot_list,
163-
ax_bbox_list=None, pad=1.08, h_pad=None, w_pad=None, rect=None):
164-
"""
165-
Return a dict of subplot parameters to adjust spacing between subplots
166-
or ``None`` if resulting axes would have zero height or width.
167-
168-
Note that this function ignores geometry information of subplot
169-
itself, but uses what is given by the *nrows_ncols* and *num1num2_list*
170-
parameters. Also, the results could be incorrect if some subplots have
171-
``adjustable=datalim``.
172-
173-
Parameters
174-
----------
175-
nrows_ncols : tuple[int, int]
176-
Number of rows and number of columns of the grid.
177-
num1num2_list : list[tuple[int, int]]
178-
List of numbers specifying the area occupied by the subplot
179-
subplot_list : list of subplots
180-
List of subplots that will be used to calculate optimal subplot_params.
181-
pad : float
182-
Padding between the figure edge and the edges of subplots, as a
183-
fraction of the font size.
184-
h_pad, w_pad : float
185-
Padding (height/width) between edges of adjacent subplots, as a
186-
fraction of the font size. Defaults to *pad*.
187-
rect : tuple
188-
(left, bottom, right, top), default: None.
189-
"""
190-
nrows, ncols = nrows_ncols
191-
span_pairs = []
192-
for n1, n2 in num1num2_list:
193-
if n2 is None:
194-
n2 = n1
195-
span_pairs.append((slice(n1 // ncols, n2 // ncols + 1),
196-
slice(n1 % ncols, n2 % ncols + 1)))
197-
return _auto_adjust_subplotpars(
198-
fig, renderer, nrows_ncols, num1num2_list, subplot_list,
199-
ax_bbox_list, pad, h_pad, w_pad, rect)
200-
201-
202160
def get_subplotspec_list(axes_list, grid_spec=None):
203161
"""
204162
Return a list of subplotspec from the given list of axes.

lib/matplotlib/axes/_axes.py

+10-22
Original file line numberDiff line numberDiff line change
@@ -2881,10 +2881,9 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
28812881
28822882
stem([locs,] heads, linefmt=None, markerfmt=None, basefmt=None)
28832883
2884-
The *locs*-positions are optional. The formats may be provided either
2885-
as positional or as keyword-arguments.
2886-
Passing *markerfmt* and *basefmt* positionally is deprecated since
2887-
Matplotlib 3.5.
2884+
The *locs*-positions are optional. *linefmt* may be provided as
2885+
positional, but all other formats must be provided as
2886+
keyword-arguments.
28882887
28892888
Parameters
28902889
----------
@@ -2957,8 +2956,8 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
29572956
`stem <https://www.mathworks.com/help/matlab/ref/stem.html>`_
29582957
which inspired this method.
29592958
"""
2960-
if not 1 <= len(args) <= 5:
2961-
raise TypeError('stem expected between 1 and 5 positional '
2959+
if not 1 <= len(args) <= 3:
2960+
raise TypeError('stem expected between 1 or 3 positional '
29622961
'arguments, got {}'.format(args))
29632962
_api.check_in_list(['horizontal', 'vertical'], orientation=orientation)
29642963

@@ -2971,12 +2970,6 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
29712970
locs = np.arange(len(heads))
29722971
else:
29732972
locs, heads, *args = args
2974-
if len(args) > 1:
2975-
_api.warn_deprecated(
2976-
"3.5",
2977-
message="Passing the markerfmt parameter positionally is "
2978-
"deprecated since Matplotlib %(since)s; the "
2979-
"parameter will become keyword-only %(removal)s.")
29802973

29812974
if orientation == 'vertical':
29822975
locs, heads = self._process_unit_info([("x", locs), ("y", heads)])
@@ -2990,8 +2983,8 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
29902983

29912984
# resolve marker format
29922985
if markerfmt is None:
2993-
# if not given as kwarg, check for positional or fall back to 'o'
2994-
markerfmt = args[1] if len(args) > 1 else "o"
2986+
# if not given as kwarg, fall back to 'o'
2987+
markerfmt = "o"
29952988
if markerfmt == '':
29962989
markerfmt = ' ' # = empty line style; '' would resolve rcParams
29972990
markerstyle, markermarker, markercolor = \
@@ -3005,8 +2998,7 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
30052998

30062999
# resolve baseline format
30073000
if basefmt is None:
3008-
basefmt = (args[2] if len(args) > 2 else
3009-
"C2-" if mpl.rcParams["_internal.classic_mode"] else
3001+
basefmt = ("C2-" if mpl.rcParams["_internal.classic_mode"] else
30103002
"C3-")
30113003
basestyle, basemarker, basecolor = _process_plot_format(basefmt)
30123004

@@ -5428,15 +5420,11 @@ def fill_betweenx(self, y, x1, x2=0, where=None,
54285420

54295421
#### plotting z(x, y): imshow, pcolor and relatives, contour
54305422

5431-
# Once this deprecation elapses, also move vmin, vmax right after norm, to
5432-
# match the signature of other methods returning ScalarMappables and keep
5433-
# the documentation for *norm*, *vmax* and *vmin* together.
5434-
@_api.make_keyword_only("3.5", "aspect")
54355423
@_preprocess_data()
54365424
@_docstring.interpd
5437-
def imshow(self, X, cmap=None, norm=None, aspect=None,
5425+
def imshow(self, X, cmap=None, norm=None, *, aspect=None,
54385426
interpolation=None, alpha=None,
5439-
vmin=None, vmax=None, origin=None, extent=None, *,
5427+
vmin=None, vmax=None, origin=None, extent=None,
54405428
interpolation_stage=None, filternorm=True, filterrad=4.0,
54415429
resample=None, url=None, **kwargs):
54425430
"""

lib/matplotlib/axis.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,6 @@ def _apply_tickdir(self, tickdir):
217217
self._tickdir = tickdir
218218
self._pad = self._base_pad + self.get_tick_padding()
219219

220-
@_api.deprecated("3.5", alternative="`.Axis.set_tick_params`")
221-
def apply_tickdir(self, tickdir):
222-
self._apply_tickdir(tickdir)
223-
self.stale = True
224-
225220
def get_tickdir(self):
226221
return self._tickdir
227222

@@ -666,8 +661,7 @@ def __init__(self, axes, pickradius=15):
666661
self.axes = axes
667662
self.major = Ticker()
668663
self.minor = Ticker()
669-
self.callbacks = cbook.CallbackRegistry(
670-
signals=["units", "units finalize"])
664+
self.callbacks = cbook.CallbackRegistry(signals=["units"])
671665

672666
self._autolabelpos = True
673667

@@ -880,8 +874,7 @@ def clear(self):
880874
self._set_scale('linear')
881875

882876
# Clear the callback registry for this axis, or it may "leak"
883-
self.callbacks = cbook.CallbackRegistry(
884-
signals=["units", "units finalize"])
877+
self.callbacks = cbook.CallbackRegistry(signals=["units"])
885878

886879
# whether the grids are on
887880
self._major_tick_kw['gridOn'] = (
@@ -1698,7 +1691,6 @@ def set_units(self, u):
16981691
axis.units = u
16991692
axis._update_axisinfo()
17001693
axis.callbacks.process('units')
1701-
axis.callbacks.process('units finalize')
17021694
axis.stale = True
17031695

17041696
def get_units(self):

lib/matplotlib/backends/backend_pgf.py

-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ def __init__(self):
308308
# Per-instance cache.
309309
self._get_box_metrics = functools.lru_cache()(self._get_box_metrics)
310310

311-
str_cache = _api.deprecated("3.5")(property(lambda self: {}))
312311
texcommand = _api.deprecated("3.6")(
313312
property(lambda self: mpl.rcParams["pgf.texsystem"]))
314313
latex_header = _api.deprecated("3.6")(

lib/matplotlib/backends/qt_compat.py

-9
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from packaging.version import parse as parse_version
2222

2323
import matplotlib as mpl
24-
from matplotlib import _api
2524

2625
from . import _QT_FORCE_QT5_BINDING
2726

@@ -267,11 +266,3 @@ def handle(*args):
267266
signal.signal(signal.SIGINT, old_sigint_handler)
268267
if handler_args is not None:
269268
old_sigint_handler(*handler_args)
270-
271-
272-
@_api.caching_module_getattr
273-
class __getattr__:
274-
ETS = _api.deprecated("3.5")(property(lambda self: dict(
275-
pyqt5=(QT_API_PYQT5, 5), pyside2=(QT_API_PYSIDE2, 5))))
276-
QT_RC_MAJOR_VERSION = _api.deprecated("3.5")(property(
277-
lambda self: int(QtCore.qVersion().split(".")[0])))

0 commit comments

Comments
 (0)