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

Skip to content

Commit cf02034

Browse files
committed
Ignore papersize when outputting plain EPS
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.
1 parent f9b59bc commit cf02034

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

lib/matplotlib/backends/backend_ps.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -869,16 +869,20 @@ def _print_figure(
869869
if papertype == 'auto':
870870
papertype = _get_papertype(
871871
*orientation.swap_if_landscape((width, height)))
872-
paper_width, paper_height = orientation.swap_if_landscape(
873-
papersize[papertype])
874872

875-
if mpl.rcParams['ps.usedistiller']:
876-
# distillers improperly clip eps files if pagesize is too small
877-
if width > paper_width or height > paper_height:
878-
papertype = _get_papertype(
879-
*orientation.swap_if_landscape((width, height)))
880-
paper_width, paper_height = orientation.swap_if_landscape(
881-
papersize[papertype])
873+
if is_eps:
874+
paper_width, paper_height = width, height
875+
else:
876+
paper_width, paper_height = orientation.swap_if_landscape(
877+
papersize[papertype])
878+
879+
if mpl.rcParams['ps.usedistiller']:
880+
# distillers improperly clip eps files if pagesize is too small
881+
if width > paper_width or height > paper_height:
882+
papertype = _get_papertype(
883+
*orientation.swap_if_landscape((width, height)))
884+
paper_width, paper_height = orientation.swap_if_landscape(
885+
papersize[papertype])
882886

883887
# center the figure on the paper
884888
xo = 72 * 0.5 * (paper_width - width)

0 commit comments

Comments
 (0)