From 128b50577d79f3979a66a627152ec984063fedc7 Mon Sep 17 00:00:00 2001 From: pwuertz Date: Tue, 28 Aug 2012 09:30:12 +0200 Subject: [PATCH] workaround for fixed dpi assumption in adjust_bbox_pdf --- lib/matplotlib/tight_bbox.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tight_bbox.py b/lib/matplotlib/tight_bbox.py index bc0b138b7562..26eff5516adb 100644 --- a/lib/matplotlib/tight_bbox.py +++ b/lib/matplotlib/tight_bbox.py @@ -88,7 +88,12 @@ def adjust_bbox_pdf(fig, bbox_inches): adjust_bbox for pdf & eps format """ - tr = Affine2D().scale(72) + if fig._cachedRenderer.__class__.__name__ == "RendererPgf": + tr = Affine2D().scale(fig.dpi) + f = 1. + else: + tr = Affine2D().scale(72) + f = 72. / fig.dpi _bbox = TransformedBbox(bbox_inches, tr) @@ -96,7 +101,6 @@ def adjust_bbox_pdf(fig, bbox_inches): bbox_inches.width, bbox_inches.height) x0, y0 = _bbox.x0, _bbox.y0 - f = 72. / fig.dpi w1, h1 = fig.bbox.width*f, fig.bbox.height*f fig.transFigure._boxout = Bbox.from_bounds(-x0, -y0, w1, h1)