Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Expire deprecations from 3.6 #24984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8e59326
Unify pickradius arguments and checking
oscargus Jan 14, 2023
c6491af
Remove date_ticker_factory
oscargus Jan 14, 2023
79e7e8b
Remove checkdep_usetex
oscargus Jan 14, 2023
9aa564c
Expire deprecations
oscargus Jan 14, 2023
e5a456b
Remove stride_windows
oscargus Jan 14, 2023
ead1c17
Make most arguments to Line2D keyword only
oscargus Jan 14, 2023
49d5ef9
Remove get_font_config
oscargus Jan 14, 2023
c2f97a7
Make most arguments to Text keyword only
oscargus Jan 14, 2023
fe925f6
Remove get_rotation
oscargus Jan 14, 2023
f146c00
Make all arguments to Collection and most to subclasses keyword only
oscargus Jan 14, 2023
20e0f80
Remove additional arguments to get_window_extent
oscargus Jan 14, 2023
9b9684d
Remove delay and output_args properties from ImageMagickBase
oscargus Jan 14, 2023
350735e
Make most arguments to Figure/figure keyword only
oscargus Jan 14, 2023
1a907a6
Expire parameter renamings
oscargus Jan 14, 2023
9044761
Make most arguments to Image classes keyword only
oscargus Jan 14, 2023
a8fd351
Make most arguments to Legend keyword only
oscargus Jan 14, 2023
61fa4f2
Make most arguments to OffsetBox classes keyword only
oscargus Jan 14, 2023
f7576ff
Make most arguments to Cell keyword only
oscargus Jan 14, 2023
f86cfb2
Remove get_texmanager
oscargus Jan 14, 2023
6cdd1bb
Remove identify
oscargus Jan 14, 2023
c9942be
Remove move_from_center. tick_update_position, set_pane_pos, and w_*axis
oscargus Jan 14, 2023
ba959ad
Remove AddList, Padded, SizeFromFunc, and GetExtentHelper
oscargus Jan 14, 2023
54a11c0
Remove delta* and new_gridlines
oscargus Jan 14, 2023
5596329
Remove dist and make most argument to set_zlim keyword only
oscargus Jan 14, 2023
98866a2
Make most argument to set_*lim keyword only
oscargus Jan 14, 2023
1b2c011
Remove label
oscargus Jan 14, 2023
74cb288
Remove execute_constrained_layout
oscargus Jan 14, 2023
7c7a34a
Remove CleanupTestCase, cleanup, and check_freetype_version
oscargus Jan 14, 2023
a5d18ab
Remove use_line_collection argument to stem
oscargus Jan 14, 2023
759f3f7
Remove get_renderer_cache
oscargus Jan 14, 2023
d090165
Remove privatized or unused helper functions
oscargus Jan 14, 2023
1fedc53
Make most arguments to Patch classes keyword only
oscargus Jan 14, 2023
832924b
Fix documentation
oscargus Jan 14, 2023
55b83c6
Add api change note
oscargus Jan 15, 2023
c2b3f1f
Take review comments into account
oscargus Mar 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion doc/api/axes_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,6 @@ Drawing
Axes.draw
Axes.draw_artist
Axes.redraw_in_frame
Axes.get_renderer_cache

Axes.get_rasterization_zorder
Axes.set_rasterization_zorder
Expand Down
4 changes: 0 additions & 4 deletions doc/api/axis_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ Rendering helpers

Axis.get_minpos
Axis.get_tick_space
Axis.get_ticklabel_extents
Axis.get_tightbbox


Expand Down Expand Up @@ -179,7 +178,6 @@ XAxis Specific
:nosignatures:

XAxis.axis_name
XAxis.get_text_heights
XAxis.get_ticks_position
XAxis.set_ticks_position
XAxis.set_label_position
Expand All @@ -195,7 +193,6 @@ YAxis Specific
:nosignatures:

YAxis.axis_name
YAxis.get_text_widths
YAxis.get_ticks_position
YAxis.set_offset_position
YAxis.set_ticks_position
Expand Down Expand Up @@ -260,7 +257,6 @@ specify a matching series of labels. Calling ``set_ticks`` makes a

Tick.get_loc
Tick.get_pad
Tick.get_pad_pixels
Tick.get_tick_padding
Tick.get_tickdir
Tick.get_view_interval
Expand Down
174 changes: 174 additions & 0 deletions doc/api/next_api_changes/removals/24984-OG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
Parameters to ``plt.figure()`` and the ``Figure`` constructor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

All parameters to `.pyplot.figure` and the `.Figure` constructor, other than
*num*, *figsize*, and *dpi*, are now keyword-only.

``stem(..., use_line_collection=False)``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

... is no longer supported. This was a compatibility fallback to a
former more inefficient representation of the stem lines.

Positional / keyword arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Passing all but the very few first arguments positionally in the constructors
of Artists is no longer possible. Most arguments are now keyword-only.

The *emit* and *auto* parameters of ``set_xlim``, ``set_ylim``,
``set_zlim``, ``set_rlim`` are now keyword-only.

The *transOffset* parameter of `.Collection.set_offset_transform` and the
various ``create_collection`` methods of legend handlers has been renamed to
*offset_transform* (consistently with the property name).

``Axes.get_window_extent`` / ``Figure.get_window_extent`` accept only
*renderer*. This aligns the API with the general `.Artist.get_window_extent`
API. All other parameters were ignored anyway.

Methods to set parameters in ``LogLocator`` and ``LogFormatter*``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In `~.LogFormatter` and derived subclasses, the methods ``base`` and
``label_minor`` for setting the respective parameter are removed and
replaced by ``set_base`` and ``set_label_minor``, respectively.

In `~.LogLocator`, the methods ``base`` and ``subs`` for setting the respective
parameter are removed. Instead, use ``set_params(base=..., subs=...)``.

``Axes.get_renderer_cache``
~~~~~~~~~~~~~~~~~~~~~~~~~~~

The canvas now takes care of the renderer and whether to cache it or not,
so the ``Axes.get_renderer_cache`` method is removed. The
alternative is to call ``axes.figure.canvas.get_renderer()``.

Unused methods in ``Axis``, ``Tick``, ``XAxis``, and ``YAxis``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

``Tick.label`` is now removed. Use ``Tick.label1`` instead.

The following methods are no longer used and removed without a replacement:

- ``Axis.get_ticklabel_extents``
- ``Tick.get_pad_pixels``
- ``XAxis.get_text_heights``
- ``YAxis.get_text_widths``

``mlab.stride_windows``
~~~~~~~~~~~~~~~~~~~~~~~

... is removed. Use ``numpy.lib.stride_tricks.sliding_window_view`` instead.

``Axes3D``
~~~~~~~~~~

The ``dist`` attribute has been privatized. Use the *zoom* keyword argument in
`.Axes3D.set_box_aspect` instead.

The ``w_xaxis``, ``w_yaxis``, and ``w_zaxis`` attributes are now removed.
Instead use ``xaxis``, ``yaxis``, and ``zaxis``.

3D Axis
~~~~~~~

``mplot3d.axis3d.Axis.set_pane_pos`` is removed. This is an internal method
where the provided values are overwritten during drawing. Hence, it does not
serve any purpose to be directly accessible.

The two helper functions ``mplot3d.axis3d.move_from_center`` and
``mplot3d.axis3d.tick_update_position`` are considered internal and deprecated.
If these are required, please vendor the code from the corresponding private
methods ``_move_from_center`` and ``_tick_update_position``.

``checkdep_usetex`` removed
~~~~~~~~~~~~~~~~~~~~~~~~~~~

This method was only intended to disable tests in case no latex install was
found. As such, it is considered to be private and for internal use only.

Please vendor the code from a previous version if you need this.

``date_ticker_factory`` removed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``date_ticker_factory`` method in the `matplotlib.dates` module is
removed. Instead use `~.AutoDateLocator` and `~.AutoDateFormatter` for a
more flexible and scalable locator and formatter.

If you need the exact ``date_ticker_factory`` behavior, please copy the code
from a previous version.

``transforms.Affine2D.identity()``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

... is removed in favor of directly calling the `.Affine2D` constructor with
no arguments.

Removals in ``testing.decorators``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The unused class ``CleanupTestCase`` and decorator ``cleanup`` are removed.
The function ``check_freetype_version`` is considered internal and removed.
Vendor the code from a previous version.

``text.get_rotation()``
~~~~~~~~~~~~~~~~~~~~~~~

... is removed with no replacement. Copy the previous implementation if
needed.

Miscellaneous internals
~~~~~~~~~~~~~~~~~~~~~~~

- ``axes_grid1.axes_size.AddList``; use ``sum(sizes, start=Fixed(0))`` (for
example) to sum multiple size objects.
- ``axes_size.Padded``; use ``size + pad`` instead
- ``axes_size.SizeFromFunc``, ``axes_size.GetExtentHelper``
- ``AxisArtistHelper.delta1`` and ``AxisArtistHelper.delta2``
- ``axislines.GridHelperBase.new_gridlines`` and
``axislines.Axes.new_gridlines``
- ``_DummyAxis.dataLim`` and ``_DummyAxis.viewLim``; use
``get_data_interval()``, ``set_data_interval()``, ``get_view_interval()``,
and ``set_view_interval()`` instead.
- ``ImageMagickBase.delay`` and ``ImageMagickBase.output_args``
- ``MathtextBackend``, ``MathtextBackendAgg``, ``MathtextBackendPath``,
``MathTextWarning``
- ``TexManager.get_font_config``; it previously returned an internal hashed key
for used for caching purposes.
- ``TextToPath.get_texmanager``; directly construct a `.texmanager.TexManager`
instead.
- ``ticker.is_close_to_int``; use ``math.isclose(x, round(x))`` instead.
- ``ticker.is_decade``; use ``y = numpy.log(x)/numpy.log(base);
numpy.isclose(y, numpy.round(y))`` instead.


Backend-specific removals
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- ``backend_pdf.Name.hexify``
- ``backend_pdf.Operator`` and ``backend_pdf.Op.op`` are removed in favor of
a single standard `enum.Enum` interface on `.backend_pdf.Op`.
- ``backend_pdf.fill``; vendor the code of the similarly named private
functions if you rely on these functions.
- ``backend_pgf.LatexManager.texcommand`` and
``backend_pgf.LatexManager.latex_header``
- ``backend_pgf.NO_ESCAPE``
- ``backend_pgf.common_texification``
- ``backend_pgf.get_fontspec``
- ``backend_pgf.get_preamble``
- ``backend_pgf.re_mathsep``
- ``backend_pgf.writeln``
- ``backend_ps.convert_psfrags``
- ``backend_ps.quote_ps_string``; vendor the code of the similarly named
private functions if you rely on it.
- ``backend_svg.escape_attrib``; vendor the code of the similarly named private
functions if you rely on it.
- ``backend_svg.escape_cdata``; vendor the code of the similarly named private
functions if you rely on it.
- ``backend_svg.escape_comment``; vendor the code of the similarly named
private functions if you rely on it.
- ``backend_svg.short_float_fmt``; vendor the code of the similarly named
private functions if you rely on it.
- ``backend_svg.generate_transform`` and ``backend_svg.generate_css``
8 changes: 4 additions & 4 deletions doc/api/prev_api_changes/api_changes_3.1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ instead of ``\usepackage{ucs}\usepackage[utf8x]{inputenc}``.

Exception changes
-----------------
- `mpl_toolkits.axes_grid1.axes_size.GetExtentHelper` now raises `ValueError`
- ``mpl_toolkits.axes_grid1.axes_size.GetExtentHelper`` now raises `ValueError`
for invalid directions instead of `KeyError`.
- Previously, subprocess failures in the animation framework would raise either
in a `RuntimeError` or a `ValueError` depending on when the error occurred.
Expand Down Expand Up @@ -932,9 +932,9 @@ internal datetime representation; or use ``dates.datestr2num``.
Axes3D
~~~~~~

- `.axes3d.Axes3D.w_xaxis`
- `.axes3d.Axes3D.w_yaxis`
- `.axes3d.Axes3D.w_zaxis`
- ``.axes3d.Axes3D.w_xaxis``
- ``.axes3d.Axes3D.w_yaxis``
- ``.axes3d.Axes3D.w_zaxis``

Use ``axes3d.Axes3D.xaxis``, ``axes3d.Axes3D.yaxis`` and
``axes3d.Axes3D.zaxis`` instead.
Expand Down
2 changes: 1 addition & 1 deletion doc/api/prev_api_changes/api_changes_3.6.0/removals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ The following module-level classes/variables have been removed:
``mathtext.latex_to_standard``
- ``mathtext.MathtextBackendPdf``, ``mathtext.MathtextBackendPs``,
``mathtext.MathtextBackendSvg``, ``mathtext.MathtextBackendCairo``; use
`.MathtextBackendPath` instead.
``.MathtextBackendPath`` instead.
- ``mathtext.Node`` and all its subclasses
- ``mathtext.NUM_SIZE_LEVELS``
- ``mathtext.Parser``
Expand Down
3 changes: 0 additions & 3 deletions doc/api/toolkits/mplot3d/axes3d.rst
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,6 @@ Aliases and deprecated methods
tunit_cube
tunit_edges
unit_cube
w_xaxis
w_yaxis
w_zaxis


Other
Expand Down
2 changes: 1 addition & 1 deletion doc/users/prev_whats_new/dflt_style_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ default. The default face color is now ``'C0'`` instead of ``'b'``.
ax_bottom.set_ylim(0, .75)
ax_bottom.add_artist(mpatches.Rectangle(grid[1] - [0.025, 0.05],
0.05, 0.1))
ax_bottom.add_artist(mpatches.RegularPolygon(grid[3], 5, 0.1))
Copy link
Member Author

@oscargus oscargus Jan 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One would have expected this to warn earlier?

Edit: it did warn, but it seems like the doc-build didn't pick it up.

ax_bottom.add_artist(mpatches.RegularPolygon(grid[3], 5, radius=0.1))
ax_bottom.add_artist(mpatches.Ellipse(grid[4], 0.2, 0.1))
ax_bottom.add_artist(mpatches.Circle(grid[0], 0.1))
ax_bottom.axis('off')
Expand Down
2 changes: 1 addition & 1 deletion doc/users/prev_whats_new/whats_new_1.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Support for strides in mlab
Todd Jennings added some functions to mlab to make it easier to use NumPy
strides to create memory-efficient 2D arrays. This includes
``matplotlib.mlab.stride_repeat``, which repeats an array to create a 2D
array, and :func:`~matplotlib.mlab.stride_windows`, which uses a moving window
array, and ``matplotlib.mlab.stride_windows``, which uses a moving window
to create a 2D array from a 1D array.

Formatter for new-style formatting strings
Expand Down
20 changes: 0 additions & 20 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,26 +462,6 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
raise ValueError(f"Unknown executable: {name!r}")


@_api.deprecated("3.6", alternative="a vendored copy of this function")
def checkdep_usetex(s):
if not s:
return False
if not shutil.which("tex"):
_log.warning("usetex mode requires TeX.")
return False
try:
_get_executable_info("dvipng")
except ExecutableNotFoundError:
_log.warning("usetex mode requires dvipng.")
return False
try:
_get_executable_info("gs")
except ExecutableNotFoundError:
_log.warning("usetex mode requires ghostscript.")
return False
return True


def _get_xdg_config_dir():
"""
Return the XDG configuration directory, according to the XDG base
Expand Down
15 changes: 2 additions & 13 deletions lib/matplotlib/_mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
pyparsing_common)

import matplotlib as mpl
from . import _api, cbook
from . import cbook
from ._mathtext_data import (
latex_to_bakoma, stix_glyph_fixes, stix_virtual_fonts, tex2uni)
from .font_manager import FontProperties, findfont, get_font
Expand All @@ -35,8 +35,7 @@
# FONTS


@_api.delete_parameter("3.6", "math")
def get_unicode_index(symbol, math=False): # Publicly exported.
def get_unicode_index(symbol): # Publicly exported.
r"""
Return the integer index (from the Unicode table) of *symbol*.

Expand All @@ -45,17 +44,7 @@ def get_unicode_index(symbol, math=False): # Publicly exported.
symbol : str
A single (Unicode) character, a TeX command (e.g. r'\pi') or a Type1
symbol name (e.g. 'phi').
math : bool, default: False
If True (deprecated), replace ASCII hyphen-minus by Unicode minus.
"""
# From UTF #25: U+2212 minus sign is the preferred
# representation of the unary and binary minus sign rather than
# the ASCII-derived U+002D hyphen-minus, because minus sign is
# unambiguous and because it is rendered with a more desirable
# length, usually longer than a hyphen.
# Remove this block when the 'math' parameter is deleted.
if math and symbol == '-':
return 0x2212
try: # This will succeed if symbol is a single Unicode char
return ord(symbol)
except TypeError:
Expand Down
12 changes: 0 additions & 12 deletions lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,18 +615,6 @@ class ImageMagickBase:
_exec_key = 'animation.convert_path'
_args_key = 'animation.convert_args'

@_api.deprecated("3.6")
@property
def delay(self):
return 100. / self.fps

@_api.deprecated("3.6")
@property
def output_args(self):
extra_args = (self.extra_args if self.extra_args is not None
else mpl.rcParams[self._args_key])
return [*extra_args, self.outfile]

def _args(self):
# ImageMagick does not recognize "raw".
fmt = "rgba" if self.frame_format == "raw" else self.frame_format
Expand Down
Loading