Open
Description
Bug report
Bug summary
Texts outside of the axes extents interact "interestingly" with constrained_layout.
Code for reproduction
ax = figure(constrained_layout=True).add_subplot(); ax.plot([0, 1]); ax.text(2, 2, "hello")
ax = figure(constrained_layout=True).add_subplot(); ax.plot([0, 1]); ax.text(4, 4, "hello")
Actual outcome
The first example gives
the second one
together with (only for the second one)
UserWarning: constrained_layout not applied because axes sizes collapsed to zero. Try making figure larger or axes decorations smaller.
(You can also try to pan the axes and get interesting results in that way.)
Expected outcome
I'm not actually sure how I'd actually want constrained_layout to handle such cases, but the current state seems... shaky.
Matplotlib version
- Operating system: linux
- Matplotlib version (
import matplotlib; print(matplotlib.__version__)
): HEAD - Matplotlib backend (
print(matplotlib.get_backend())
): qt5agg - Python version: 39
- Jupyter version (if applicable):
- Other libraries:
Metadata
Metadata
Assignees
Labels
LayoutEngine, Constrained layout, Tight layoutLayoutEngine, Constrained layout, Tight layout