Skip to content

Backport PR #18100 on branch v3.3.0-doc (DOC: update tight layout guide with set_in_layout) #18108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions tutorials/intermediate/tight_layout_guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
# =================
Expand Down