Skip to content

Commit

Permalink
Ignore papersize when outputting plain EPS
Browse files Browse the repository at this point in the history
When usetex is enabled, then EPS ignores the papersize passed to
`savefig` / `rcParams`. Additionally, when distilling, if outputting
EPS, the papersize is ignored.

This makes things consistent when not using usetex and not distilling.
  • Loading branch information
QuLogic committed Apr 28, 2023
1 parent f9b59bc commit cf02034
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions lib/matplotlib/backends/backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,16 +869,20 @@ def _print_figure(
if papertype == 'auto':
papertype = _get_papertype(
*orientation.swap_if_landscape((width, height)))
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
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
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)
Expand Down

0 comments on commit cf02034

Please sign in to comment.