Skip to content

Remove outdated statement in tight_layout guide. #16202

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
merged 1 commit into from
Jan 13, 2020
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
6 changes: 3 additions & 3 deletions tutorials/intermediate/tight_layout_guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,15 @@ def example_plot(ax, fontsize=12):
# ========
#
# If you create a colorbar with `.Figure.colorbar`, the created colorbar is
# an instance of Axes, *not* Subplot, so tight_layout does not work. With
# Matplotlib v1.1, you may create a colorbar as a subplot using the gridspec.
# drawn in a Subplot as long as the parent axes is also a Subplot, so
# `.Figure.tight_layout` will work.

plt.close('all')
arr = np.arange(100).reshape((10, 10))
fig = plt.figure(figsize=(4, 4))
im = plt.imshow(arr, interpolation="none")

plt.colorbar(im, use_gridspec=True)
plt.colorbar(im)

plt.tight_layout()

Expand Down