8000 Merge pull request #29691 from meeseeksmachine/auto-backport-of-pr-29… · matplotlib/matplotlib@c38e0f7 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c38e0f7

Browse files
authored
Merge pull request #29691 from meeseeksmachine/auto-backport-of-pr-29584-on-v3.10.x
Backport PR #29584 on branch v3.10.x (DOC: Recommend constrained_layout over tight_layout)
2 parents 14d07d6 + 50cad2a commit c38e0f7

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

galleries/users_explain/axes/tight_layout_guide.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99
1010
How to use tight-layout to fit plots within your figure cleanly.
1111
12+
.. tip::
13+
14+
*tight_layout* was the first layout engine in Matplotlib. The more modern
15+
and more capable :ref:`Constrained Layout <constrainedlayout_guide>` should
16+
typically be used instead.
17+
1218
*tight_layout* automatically adjusts subplot params so that the
1319
subplot(s) fits in to the figure area. This is an experimental
1420
feature and may not work for some cases. It only checks the extents
1521
of ticklabels, axis labels, and titles.
1622
17-
An alternative to *tight_layout* is :ref:`constrained_layout
18-
<constrainedlayout_guide>`.
19-
20-
2123
Simple example
2224
==============
2325

lib/matplotlib/layout_engine.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@
1010
layout engine while the figure is being created. In particular, colorbars are
1111
made differently with different layout engines (for historical reasons).
1212
13-
Matplotlib supplies two layout engines, `.TightLayoutEngine` and
14-
`.ConstrainedLayoutEngine`. Third parties can create their own layout engine
15-
by subclassing `.LayoutEngine`.
13+
Matplotlib has two built-in layout engines:
14+
15+
- `.TightLayoutEngine` was the first layout engine added to Matplotlib.
16+
See also :ref:`tight_layout_guide`.
17+
- `.ConstrainedLayoutEngine` is more modern and generally gives better results.
18+
See also :ref:`constrainedlayout_guide`.
19+
20+
Third parties can create their own layout engine by subclassing `.LayoutEngine`.
1621
"""
1722

1823
from contextlib import nullcontext

0 commit comments

Comments
 (0)
0