Skip to content

Commit 7f200fd

Browse files
author
miranov25
committed
draw_batch: fix suptitle overlap with subplot titles
Replace tight_layout() + subplots_adjust(top=0.92) with tight_layout(rect=[0, 0, 1, 0.95]) when suptitle is set. This tells tight_layout to arrange subplots within the bottom 95% of the figure, leaving room for suptitle without colliding with subplot titles. The old pattern called tight_layout() first (which used the full figure area), then subplots_adjust(top=0.92) squeezed afterward — but tight_layout had already positioned subplot titles without knowing about the reserved space, causing overlap.
1 parent cf62cf3 commit 7f200fd

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

UTILS/dfextensions/dfdraw/drawer.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,9 +1260,6 @@ def hist(
12601260
for name in self._HIST_FORWARDED_NAMES:
12611261
val = _local.get(name, _MISSING)
12621262
if val is not _MISSING and val is not None:
1263-
# FIX1: auto_title=False is signature default, not user choice.
1264-
if name == 'auto_title' and val is False:
1265-
continue
12661263
vector_kwargs.setdefault(name, val)
12671264
return self._draw_vector(
12681265
y_expr, x_expr, self.hist,
@@ -1677,10 +1674,6 @@ def profile(
16771674
for name in self._PROFILE_FORWARDED_NAMES:
16781675
val = _local.get(name, _MISSING)
16791676
if val is not _MISSING and val is not None:
1680-
# FIX1: auto_title=False is the SIGNATURE DEFAULT, not a user choice.
1681-
# Skip it so _draw_vector's vector-mode default-True logic can inject.
1682-
if name == 'auto_title' and val is False:
1683-
continue
16841677
vector_kwargs.setdefault(name, val)
16851678
return self._draw_vector(
16861679
y_expr, x_expr, self.profile,
@@ -2728,10 +2721,13 @@ def _draw_batch_groups(
27282721
fontsize=get_style_value("axes.titlesize", 14) + 2
27292722
)
27302723

2731-
# Layout
2732-
plt.tight_layout()
2724+
# Layout — tight_layout with reserved space for suptitle
27332725
if suptitle:
2734-
plt.subplots_adjust(top=0.92)
2726+
# Reserve top 5% for suptitle; tight_layout arranges
2727+
# subplots (including their titles) within the remainder.
2728+
plt.tight_layout(rect=[0, 0, 1, 0.95])
2729+
else:
2730+
plt.tight_layout()
27352731

27362732
# Save
27372733
save_path = None

0 commit comments

Comments
 (0)