From b1bac4cf070ac50b4f00c4354240888d0b4decb9 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sat, 26 Aug 2017 00:11:38 -0700 Subject: [PATCH] Document auto-tightlayouting. --- tutorials/intermediate/tight_layout_guide.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tutorials/intermediate/tight_layout_guide.py b/tutorials/intermediate/tight_layout_guide.py index 613ff4423ec5..b3cbb0861113 100644 --- a/tutorials/intermediate/tight_layout_guide.py +++ b/tutorials/intermediate/tight_layout_guide.py @@ -51,6 +51,11 @@ def example_plot(ax, fontsize=12): plt.tight_layout() ############################################################################### +# Note that :func:`matplotlib.pyplot.tight_layout` will only adjust the +# subplot params when it is called. In order to perform this adjustment each +# time the figure is redrawn, you can call ``fig.set_tight_layout(True)``, or, +# equivalently, set the ``figure.autolayout`` rcParam to ``True``. +# # When you have multiple subplots, often you see labels of different # axes overlapping each other. @@ -141,7 +146,7 @@ def example_plot(ax, fontsize=12): ############################################################################### # Caveats -# ------- +# ======= # # * :func:`~matplotlib.pyplot.tight_layout` only considers ticklabels, axis # labels, and titles. Thus, other artists may be clipped and also may @@ -157,7 +162,7 @@ def example_plot(ax, fontsize=12): # recommended. # # Use with GridSpec -# ----------------- +# ================= # # GridSpec has its own :func:`~matplotlib.gridspec.GridSpec.tight_layout` method # (the pyplot api :func:`~matplotlib.pyplot.tight_layout` also works). @@ -275,7 +280,7 @@ def example_plot(ax, fontsize=12): ############################################################################### # Use with AxesGrid1 -# ------------------ +# ================== # # While limited, the axes_grid1 toolkit is also supported. @@ -295,7 +300,7 @@ def example_plot(ax, fontsize=12): ############################################################################### # Colorbar -# -------- +# ======== # # If you create a colorbar with the :func:`~matplotlib.pyplot.colorbar` # command, the created colorbar is an instance of Axes, *not* Subplot, so