tight_bbox made assumptions about the display-units without checking the figure #1138

Closed
wants to merge 1 commit into
from
@@ -57,7 +57,7 @@ def restore_bbox():
return None
-def adjust_bbox_png(fig, bbox_inches):
+def _adjust_bbox(fig, bbox_inches):
"""
adjust_bbox for png (Agg) format
"""
@@ -83,31 +83,6 @@ def adjust_bbox_png(fig, bbox_inches):
fig.bbox.width/w1, fig.bbox.height/h1)
-def adjust_bbox_pdf(fig, bbox_inches):
- """
- adjust_bbox for pdf & eps format
- """
-
- tr = Affine2D().scale(72)
-
- _bbox = TransformedBbox(bbox_inches, tr)
-
- fig.bbox_inches = Bbox.from_bounds(0, 0,
- 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)
- fig.transFigure.invalidate()
-
- fig.bbox = TransformedBbox(fig.bbox_inches, tr)
-
- fig.patch.set_bounds(x0/w1, y0/h1,
- fig.bbox.width/w1, fig.bbox.height/h1)
-
-
def process_figure_for_rasterizing(figure,
bbox_inches_restore, mode):
@@ -126,7 +101,6 @@ def process_figure_for_rasterizing(figure,
_adjust_bbox_handler_d = {}
-for format in ["png", "raw", "rgba", "jpg", "jpeg", "tiff"]:
- _adjust_bbox_handler_d[format] = adjust_bbox_png
-for format in ["pdf", "eps", "svg", "svgz"]:
- _adjust_bbox_handler_d[format] = adjust_bbox_pdf
+for format in ["png", "raw", "rgba", "jpg", "jpeg", "tiff",
+ "pdf", "eps", "svg", "svgz"]:
+ _adjust_bbox_handler_d[format] = _adjust_bbox