From ec07182d9c1577e3c5e4e3a76b8cecec0a2f1bfa Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Tue, 28 Jul 2020 17:18:04 -0700 Subject: [PATCH] Backport PR #18100: DOC: update tight layout guide with set_in_layout --- tutorials/intermediate/tight_layout_guide.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tutorials/intermediate/tight_layout_guide.py b/tutorials/intermediate/tight_layout_guide.py index b1b047a3e7d3..03c8ebc417a3 100644 --- a/tutorials/intermediate/tight_layout_guide.py +++ b/tutorials/intermediate/tight_layout_guide.py @@ -152,18 +152,17 @@ 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 -# overlap. +# * `~matplotlib.pyplot.tight_layout` considers all artists on the axes by +# default. To remove an artist from the layout calculation you can call +# `.Artist.set_in_layout`. # -# * It assumes that the extra space needed for ticklabels, axis labels, -# and titles is independent of original location of axes. This is -# often true, but there are rare cases where it is not. +# * ``tight_layout`` assumes that the extra space needed for artists is +# independent of the original location of axes. This is often true, but there +# are rare cases where it is not. # -# * pad=0 clips some of the texts by a few pixels. This may be a bug or -# a limitation of the current algorithm and it is not clear why it -# happens. Meanwhile, use of pad at least larger than 0.3 is -# recommended. +# * ``pad=0`` can clip some texts by a few pixels. This may be a bug or +# a limitation of the current algorithm and it is not clear why it +# happens. Meanwhile, use of pad larger than 0.3 is recommended. # # Use with GridSpec # =================