matplotlib/matplotlib — pull request #1136 by pwuertz (2012-08-22 09:04:36+00:00)
Title: Configuring automatic use of tight_layout

This PR extends the introduction of the automatic use of tight_layout (https://github.com/matplotlib/matplotlib/pull/774)

A user currently cannot make use of the automatic layout for creating figures without padding. Use-cases for border-less figures are graphical user interfaces and embedding of figures in documents. The first commit in the PR fixes that by adding the necessary keywords to the newly introduced `tight_layout` kwarg in `figure`.

The second commit fixes a usability glitch when manually calling tight_layout. Tight_layout grabs a renderer from the active backend for determining the font metrics. Most probably this is the default renderer from an interactive backend like GtkAgg or QtAgg. If the user now chooses to save figure using the svg backend this causes inconsistent results. Instead of calculating the metrics for the target backend, matplotlib creates a layout based on whichever backend previously set. Tight_layout should not be used as a standalone function and the patch makes a call to the old methods enable the automatic use of tight_layout for the given figure.

The third commit updates the baseline images for test_tightlayout since the layouts in the test results slightly differ from the previous references.