8000 FIX: auto_fmtxdate for constrained layout · matplotlib/matplotlib@25fbacb · GitHub
[go: up one dir, main page]

Skip to content

Commit 25fbacb

Browse files
committed
FIX: auto_fmtxdate for constrained layout
1 parent 235bf97 commit 25fbacb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/matplotlib/figure.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,15 @@ def autofmt_xdate(
194194
Selects which ticklabels to rotate.
195195
"""
196196
_api.check_in_list(['major', 'minor', 'both'], which=which)
197-
allsubplots = all(ax.get_subplotspec() for ax in self.axes)
198-
if len(self.axes) == 1:
197+
axes = [ax for ax in self.axes if ax._label != '<colorbar>']
198+
allsubplots = all(ax.get_subplotspec() for ax in axes)
199+
if len(axes) == 1:
199200
for label in self.axes[0].get_xticklabels(which=which):
200201
label.set_ha(ha)
201202
label.set_rotation(rotation)
202203
else:
203204
if allsubplots:
204-
for ax in self.get_axes():
205+
for ax in axes:
205206
if ax.get_subplotspec().is_last_row():
206207
for label in ax.get_xticklabels(which=which):
207208
label.set_ha(ha)
@@ -211,7 +212,8 @@ def autofmt_xdate(
211212
label.set_visible(False)
212213
ax.set_xlabel('')
213214

214-
if allsubplots:
215+
engine = self.get_layout_engine()
216+
if allsubplots and (engine is None or engine.adjust_compatible):
215217
self.subplots_adjust(bottom=bottom)
216218
self.stale = True
217219

0 commit comments

Comments
 (0)
0