matplotlib/matplotlib — pull request #1138 by pwuertz (2012-08-22 21:57:26+00:00)
Title: tight_bbox made assumptions about the display-units without checking the figure

This PR tries to fix #1135. Tight_bbox tries to determine the bounding box of figure contents and saves a new figure that is shrunk to the new size. When saving a PDF using the PGF backend (which internally uses display-units) the scaling is wrong.

For rescaling the figure, `adjust_bbox_pdf` does some strange unit conversions I do not understand while `adjust_bbox_png` just uses the scaling matrix from the figure. Using `fig.dpi_scale_trans` works just fine for the PGF, PDF, SVG and EPS backend, so I removed the `adjust_bbox_pdf` function altogether.

There are no tests for bbox_inches and I don't really understand what bbox_inches is doing, so this needs some review.