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

Skip to content

Commit 128b505

Browse files
author
pwuertz
committed
workaround for fixed dpi assumption in adjust_bbox_pdf
1 parent 3419eb8 commit 128b505

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

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)