Skip to content

Clarify that constrained_layout and tight_layout conflict with each other #17339

Closed
@ericpre

Description

@ericpre

Bug report

Bug summary

Not sure if this an expected behaviour, but the colorbar seems to be ignored when using tight_layout. Example taken from the "Constrained Layout Guide" (https://matplotlib.org/3.1.3/tutorials/intermediate/constrainedlayout_guide.html#colorbars).

Code for reproduction

arr = np.arange(100).reshape((10, 10))
fig, axs = plt.subplots(2, 2, figsize=(4, 4), constrained_layout=True)
for ax in axs.flat:
    im = ax.pcolormesh(arr)
fig.colorbar(im, ax=axs, shrink=0.6)
plt.tight_layout()

Actual outcome

image

Expected outcome
This is the outcome before calling plt.tight_layout()

image

Matplotlib version

  • Operating system: Fedora 31
  • Matplotlib version: 3.1.3 from conda defaults (3.2.1 from conda-forge behave similarly)
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.7.6
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions