Skip to content

Commit 9892758

Browse files
committed
Merge pull request #1155 from pwuertz/temp-tight-bbox-fix
workaround for fixed dpi assumption in adjust_bbox_pdf
2 parents 50928d9 + 128b505 commit 9892758

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/matplotlib/tight_bbox.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,19 @@ def adjust_bbox_pdf(fig, bbox_inches):
8888
adjust_bbox for pdf & eps format
8989
"""
9090

91-
tr = Affine2D().scale(72)
91+
if fig._cachedRenderer.__class__.__name__ == "RendererPgf":
92+
tr = Affine2D().scale(fig.dpi)
93+
f = 1.
94+
else:
95+
tr = Affine2D().scale(72)
96+
f = 72. / fig.dpi
9297

9398
_bbox = TransformedBbox(bbox_inches, tr)
9499

95100
fig.bbox_inches = Bbox.from_bounds(0, 0,
96101
bbox_inches.width,
97102
bbox_inches.height)
98103
x0, y0 = _bbox.x0, _bbox.y0
99-
f = 72. / fig.dpi
100104
w1, h1 = fig.bbox.width*f, fig.bbox.height*f
101105
fig.transFigure._boxout = Bbox.from_bounds(-x0, -y0,
102106
w1, h1)

0 commit comments

Comments
 (0)