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 4a2acf5

Browse filesBrowse files
authored
Merge pull request #24961 from meeseeksmachine/auto-backport-of-pr-24948-on-v3.7.x
Backport PR #24948 on branch v3.7.x (Remove remaining deprecations from 3.5)
2 parents b85413a + bdf8047 commit 4a2acf5
Copy full SHA for 4a2acf5

File tree

Expand file treeCollapse file tree

20 files changed

+146
-392
lines changed
Filter options
Expand file treeCollapse file tree

20 files changed

+146
-392
lines changed
+104Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
2+
Testing support
3+
~~~~~~~~~~~~~~~
4+
5+
``matplotlib.test()`` has been removed
6+
......................................
7+
8+
Run tests using ``pytest`` from the commandline instead. The variable
9+
``matplotlib.default_test_modules`` was only used for ``matplotlib.test()`` and
10+
is thus removed as well.
11+
12+
To test an installed copy, be sure to specify both ``matplotlib`` and
13+
``mpl_toolkits`` with ``--pyargs``::
14+
15+
python -m pytest --pyargs matplotlib.tests mpl_toolkits.tests
16+
17+
See :ref:`testing` for more details.
18+
19+
20+
21+
Auto-removal of grids by `~.Axes.pcolor` and `~.Axes.pcolormesh`
22+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23+
24+
`~.Axes.pcolor` and `~.Axes.pcolormesh` previously remove any visible axes
25+
major grid. This behavior is removed; please explicitly call ``ax.grid(False)``
26+
to remove the grid.
27+
28+
29+
30+
Modification of ``Axes`` children sublists
31+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32+
33+
See :ref:`Behavioural API Changes 3.5 - Axes children combined` for more
34+
information; modification of the following sublists is no longer supported:
35+
36+
* ``Axes.artists``
37+
* ``Axes.collections``
38+
* ``Axes.images``
39+
* ``Axes.lines``
40+
* ``Axes.patches``
41+
* ``Axes.tables``
42+
* ``Axes.texts``
43+
44+
To remove an Artist, use its `.Artist.remove` method. To add an Artist, use the
45+
corresponding ``Axes.add_*`` method.
46+
47+
48+
49+
``ConversionInterface.convert`` no longer accepts unitless values
50+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51+
52+
Previously, custom subclasses of `.units.ConversionInterface` needed to
53+
implement a ``convert`` method that not only accepted instances of the unit,
54+
but also unitless values (which are passed through as is). This is no longer
55+
the case (``convert`` is never called with a unitless value), and such support
56+
in ``.StrCategoryConverter`` is removed. Likewise, the
57+
``.ConversionInterface.is_numlike`` helper is removed.
58+
59+
Consider calling `.Axis.convert_units` instead, which still supports unitless
60+
values.
61+
62+
63+
Normal list of `.Artist` objects now returned by `.HandlerLine2D.create_artists`
64+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65+
66+
For Matplotlib 3.5 and 3.6 a proxy list was returned that simulated the return
67+
of `.HandlerLine2DCompound.create_artists`. Now a list containing only the
68+
single artist is return.
69+
70+
71+
rcParams will no longer cast inputs to str
72+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73+
74+
rcParams that expect a (non-pathlike) str no longer cast non-str inputs using
75+
`str`. This will avoid confusing errors in subsequent code if e.g. a list input
76+
gets implicitly cast to a str.
77+
78+
79+
80+
Case-insensitive scales
81+
~~~~~~~~~~~~~~~~~~~~~~~
82+
83+
Previously, scales could be set case-insensitively (e.g.,
84+
``set_xscale("LoG")``). Now all builtin scales use lowercase names.
85+
86+
87+
88+
Support for ``nx1 = None`` or ``ny1 = None`` in ``AxesLocator`` and ``Divider.locate``
89+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
90+
91+
In `.axes_grid1.axes_divider`, various internal APIs no longer supports
92+
passing ``nx1 = None`` or ``ny1 = None`` to mean ``nx + 1`` or ``ny + 1``, in
93+
preparation for a possible future API which allows indexing and slicing of
94+
dividers (possibly ``divider[a:b] == divider.new_locator(a, b)``, but also
95+
``divider[a:] == divider.new_locator(a, <end>)``). The user-facing
96+
`.Divider.new_locator` API is unaffected -- it correctly normalizes ``nx1 =
97+
None`` and ``ny1 = None`` as needed.
98+
99+
100+
change signature of ``.FigureCanvasBase.enter_notify_event``
101+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102+
103+
The *xy* parameter is now required and keyword only. This was deprecated in
104+
3.0 and originally slated to be removed in 3.5.

‎doc/api/prev_api_changes/api_changes_3.5.0/deprecations.rst

Copy file name to clipboardExpand all lines: doc/api/prev_api_changes/api_changes_3.5.0/deprecations.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ implement a ``convert`` method that not only accepted instances of the unit,
162162
but also unitless values (which are passed through as is). This is no longer
163163
the case (``convert`` is never called with a unitless value), and such support
164164
in `.StrCategoryConverter` is deprecated. Likewise, the
165-
`.ConversionInterface.is_numlike` helper is deprecated.
165+
``.ConversionInterface.is_numlike`` helper is deprecated.
166166

167167
Consider calling `.Axis.convert_units` instead, which still supports unitless
168168
values.

‎doc/api/prev_api_changes/api_changes_3.5.0/removals.rst

Copy file name to clipboardExpand all lines: doc/api/prev_api_changes/api_changes_3.5.0/removals.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ Arguments
282282
- The *dummy* parameter of `.RendererPgf` has been removed.
283283
- The *props* parameter of `.Shadow` has been removed; use keyword arguments
284284
instead.
285-
- The *recursionlimit* parameter of `matplotlib.test` has been removed.
285+
- The *recursionlimit* parameter of ``matplotlib.test`` has been removed.
286286
- The *label* parameter of `.Tick` has no effect and has been removed.
287287
- `~.ticker.MaxNLocator` no longer accepts a positional parameter and the
288288
keyword argument *nbins* simultaneously because they specify the same

‎doc/api/testing_api.rst

Copy file name to clipboardExpand all lines: doc/api/testing_api.rst
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
**********************
44

55

6-
:func:`matplotlib.test`
7-
=======================
8-
9-
.. autofunction:: matplotlib.test
10-
116
:mod:`matplotlib.testing`
127
=========================
138

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
-58Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,12 +1278,6 @@ def is_interactive():
12781278
return rcParams['interactive']
12791279

12801280

1281-
default_test_modules = [
1282-
'matplotlib.tests',
1283-
'mpl_toolkits.tests',
1284-
]
1285-
1286-
12871281
def _init_tests():
12881282
# The version of FreeType to install locally for running the
12891283
# tests. This must match the value in `setupext.py`
@@ -1302,58 +1296,6 @@ def _init_tests():
13021296
"" if ft2font.__freetype_build_type__ == 'local' else "not "))
13031297

13041298

1305-
@_api.deprecated("3.5", alternative='pytest')
1306-
def test(verbosity=None, coverage=False, **kwargs):
1307-
"""Run the matplotlib test suite."""
1308-
1309-
try:
1310-
import pytest
1311-
except ImportError:
1312-
print("matplotlib.test requires pytest to run.")
1313-
return -1
1314-
1315-
if not os.path.isdir(os.path.join(os.path.dirname(__file__), 'tests')):
1316-
print("Matplotlib test data is not installed")
1317-
return -1
1318-
1319-
old_backend = get_backend()
1320-
try:
1321-
use('agg')
1322-
1323-
args = kwargs.pop('argv', [])
1324-
provide_default_modules = True
1325-
use_pyargs = True
1326-
for arg in args:
1327-
if any(arg.startswith(module_path)
1328-
for module_path in default_test_modules):
1329-
provide_default_modules = False
1330-
break
1331-
if os.path.exists(arg):
1332-
provide_default_modules = False
1333-
use_pyargs = False
1334-
break
1335-
if use_pyargs:
1336-
args += ['--pyargs']
1337-
if provide_default_modules:
1338-
args += default_test_modules
1339-
1340-
if coverage:
1341-
args += ['--cov']
1342-
1343-
if verbosity:
1344-
args += ['-' + 'v' * verbosity]
1345-
1346-
retcode = pytest.main(args, **kwargs)
1347-
finally:
1348-
if old_backend.lower() != 'agg':
1349-
use(old_backend)
1350-
1351-
return retcode
1352-
1353-
1354-
test.__test__ = False # pytest: this function is not a test
1355-
1356-
13571299
def _replacer(data, value):
13581300
"""
13591301
Either returns ``data[value]`` or passes ``data`` back, converts either to

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
-14Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5792,18 +5792,6 @@ def _interp_grid(X):
57925792
C = cbook.safe_masked_invalid(C)
57935793
return X, Y, C, shading
57945794

5795-
def _pcolor_grid_deprecation_helper(self):
5796-
grid_active = any(axis._major_tick_kw["gridOn"]
5797-
for axis in self._axis_map.values())
5798-
# explicit is-True check because get_axisbelow() can also be 'line'
5799-
grid_hidden_by_pcolor = self.get_axisbelow() is True
5800-
if grid_active and not grid_hidden_by_pcolor:
5801-
_api.warn_deprecated(
5802-
"3.5", message="Auto-removal of grids by pcolor() and "
5803-
"pcolormesh() is deprecated since %(since)s and will be "
5804-
"removed %(removal)s; please call grid(False) first.")
5805-
self.grid(False)
5806-
58075795
@_preprocess_data()
58085796
@_docstring.dedent_interpd
58095797
def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
@@ -6008,7 +5996,6 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
60085996
collection = mcoll.PolyCollection(
60095997
verts, array=C, cmap=cmap, norm=norm, alpha=alpha, **kwargs)
60105998
collection._scale_norm(norm, vmin, vmax)
6011-
self._pcolor_grid_deprecation_helper()
60125999

60136000
x = X.compressed()
60146001
y = Y.compressed()
@@ -6242,7 +6229,6 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
62426229
coords, antialiased=antialiased, shading=shading,
62436230
array=C, cmap=cmap, norm=norm, alpha=alpha, **kwargs)
62446231
collection._scale_norm(norm, vmin, vmax)
6245-
self._pcolor_grid_deprecation_helper()
62466232

62476233
coords = coords.reshape(-1, 2) # flatten the grid structure; keep x, y
62486234

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.