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

Skip to content
8000

Commit df4ff0e

Browse files
authored
Merge pull request #12742 from meeseeksmachine/auto-backport-of-pr-12740-on-v3.0.0-doc
Backport PR #12740 on branch v3.0.0-doc (DOC: constrained layout guide (fix: Spacing with colorbars))
2 parents 09c3e03 + 27db3af commit df4ff0e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tutorials/intermediate/constrainedlayout_guide.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,15 +294,17 @@ def example_plot(ax, fontsize=12, nodec=False):
294294
# Spacing with colorbars
295295
# -----------------------
296296
#
297-
# Colorbars still respect the ``w_pad`` and ``h_pad`` values. However they will
298-
# be ``wspace`` and ``hsapce`` apart from other subplots. Note the use of a
299-
# ``pad`` kwarg here in the ``colorbar`` call. It defaults to 0.02 of the size
297+
# Colorbars will be placed ``wspace`` and ``hsapce`` apart from other
298+
# subplots. The padding between the colorbar and the axis it is
299+
# attached to will never be less than ``w_pad`` (for a vertical colorbar)
300+
# or ``h_pad`` (for a horizontal colorbar). Note the use of the ``pad`` kwarg
301+
# here in the ``colorbar`` call. It defaults to 0.02 of the size
300302
# of the axis it is attached to.
301303

302304
fig, axs = plt.subplots(2, 2, constrained_layout=True)
303305
for ax in axs.flatten():
304306
pc = ax.pcolormesh(arr, **pc_kwargs)
305-
fig.colorbar(im, ax=ax, shrink=0.6, pad=0)
307+
fig.colorbar(pc, ax=ax, shrink=0.6, pad=0)
306308
ax.set_xticklabels('')
307309
ax.set_yticklabels('')
308310
fig.set_constrained_layout_pads(w_pad=2./72., h_pad=2./72.,

0 commit comments

Comments
 (0)
0