Skip to content

Commit 5f6833f

Browse files
committed
speed up suptitle centering
1 parent d1cf152 commit 5f6833f

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

control/ctrlplot.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,11 @@ def suptitle(
6868
fig.suptitle(title, **kwargs)
6969

7070
elif frame == 'axes':
71-
# TODO: move common plotting params to 'ctrlplot'
7271
with plt.rc_context(rcParams):
73-
plt.tight_layout() # Put the figure into proper layout
72+
fig.suptitle(title, **kwargs) # Place title in center
73+
plt.tight_layout() # Put everything into place
7474
xc, _ = _find_axes_center(fig, fig.get_axes())
75-
76-
fig.suptitle(title, x=xc, **kwargs)
77-
plt.tight_layout() # Update the layout
75+
fig.suptitle(title, x=xc, **kwargs) # Redraw title, centered
7876

7977
else:
8078
raise ValueError(f"unknown frame '{frame}'")

0 commit comments

Comments
 (0)