Skip to content

Move papersize="auto" deprecation to backend_bases. #26959

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 1 commit into from
Oct 2, 2023
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 @@ -2105,6 +2105,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 @@ -867,9 +867,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)))
Copy link
Member

Choose a reason for hiding this comment

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

I would leave a comment about this here, or it might be forgotten when removing the deprecation in 3.10.

Copy link
Member

Choose a reason for hiding this comment

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

And/or add a comment to the new deprecation site, because that’s where we look at during the removal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, done.


if is_eps or papertype == 'figure':
Expand Down Expand Up @@ -1053,9 +1050,6 @@ def _print_figure_tex(
self.figure.get_size_inches())
else:
if papertype == 'auto':
_api.warn_deprecated("3.8", name="papertype='auto'",
Copy link
Member

Choose a reason for hiding this comment

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

Same thing about a comment here.

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