-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deprecate papersize=auto in PostScript #25785
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Automatic papersize selection in PostScript | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Setting :rc:`ps.papersize` to ``'auto'`` or passing ``papersize='auto'`` to | ||
`.Figure.savefig` is deprecated. Either pass an explicit paper type name, or | ||
omit this parameter to use the default from the rcParam. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -867,18 +867,24 @@ def _print_figure( | |
# find the appropriate papertype | ||
width, height = self.figure.get_size_inches() | ||
if papertype == 'auto': | ||
papertype = _get_papertype( | ||
*orientation.swap_if_landscape((width, height))) | ||
paper_width, paper_height = orientation.swap_if_landscape( | ||
papersize[papertype]) | ||
_api.warn_deprecated("3.8", name="papertype='auto'", | ||
addendum="Pass an explicit paper type, or omit the " | ||
"*papertype* argument entirely.") | ||
papertype = _get_papertype(*orientation.swap_if_landscape((width, height))) | ||
|
||
if mpl.rcParams['ps.usedistiller']: | ||
# distillers improperly clip eps files if pagesize is too small | ||
if width > paper_width or height > paper_height: | ||
papertype = _get_papertype( | ||
*orientation.swap_if_landscape((width, height))) | ||
paper_width, paper_height = orientation.swap_if_landscape( | ||
papersize[papertype]) | ||
if is_eps: | ||
paper_width, paper_height = width, height | ||
else: | ||
paper_width, paper_height = orientation.swap_if_landscape( | ||
papersize[papertype]) | ||
|
||
if mpl.rcParams['ps.usedistiller']: | ||
# distillers improperly clip eps files if pagesize is too small | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment seems incongruous with this being in the If this code is specifically targeted to fix eps, then it would have to be in the if block, and if it is just wrong, perhaps it could be taken out entirely. It also relies on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah good point, since as the first commit notes, the distiller ignores the paper type and asks the distiller to crop, this is probably something that could be dropped. But I guess I will have to test out a few combinations to be sure. |
||
if width > paper_width or height > paper_height: | ||
papertype = _get_papertype( | ||
*orientation.swap_if_landscape((width, height))) | ||
paper_width, paper_height = orientation.swap_if_landscape( | ||
papersize[papertype]) | ||
|
||
# center the figure on the paper | ||
xo = 72 * 0.5 * (paper_width - width) | ||
|
@@ -1055,6 +1061,9 @@ 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] | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have been 25785 I just noted...