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

Skip to content

Backport PR #26959 on branch v3.8.x (Move papersize="auto" deprecation to backend_bases.) #26979

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
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -2123,6 +2123,12 @@ def print_figure(
if dpi == 'figure':
dpi = getattr(self.figure, '_original_dpi', self.figure.dpi)

if kwargs.get("papertype") == 'auto':
# When deprecation elapses, remove backend_ps._get_papertype & its callers.
_api.warn_deprecated(
"3.8", name="papertype='auto'", addendum="Pass an explicit paper type, "
"'figure', or omit the *papertype* argument entirely.")

# Remove the figure manager, if any, to avoid resizing the GUI widget.
with cbook._setattr_cm(self, manager=None), \
self._switch_canvas_and_return_print_method(format, backend) \
Expand Down
6 changes: 0 additions & 6 deletions lib/matplotlib/backends/backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,9 +872,6 @@ def _print_figure(
# find the appropriate papertype
width, height = self.figure.get_size_inches()
if papertype == 'auto':
_api.warn_deprecated("3.8", name="papertype='auto'",
addendum="Pass an explicit paper type, 'figure', or "
"omit the *papertype* argument entirely.")
papertype = _get_papertype(*orientation.swap_if_landscape((width, height)))

if is_eps or papertype == 'figure':
Expand Down Expand Up @@ -1058,9 +1055,6 @@ def _print_figure_tex(
self.figure.get_size_inches())
else:
if papertype == 'auto':
_api.warn_deprecated("3.8", name="papertype='auto'",
addendum="Pass an explicit paper type, or "
"omit the *papertype* argument entirely.")
papertype = _get_papertype(width, height)
paper_width, paper_height = papersize[papertype]

Expand Down