◐ Shell
clean mode source ↗

Add rcParams for figure.suptitle() kwargs (x, y, horizontalalignment, verticalalignment) by szzhoujiarui-sketch · Pull Request #31889 · matplotlib/matplotlib

PR summary

Add rcParams for figure.suptitle() default kwargs (x, y, horizontalalignment, verticalalignment), as requested in #24090.

The new rcParams are:

  • figure.title_x (float, default: 0.5)
  • figure.title_y (float, default: 0.98)
  • figure.title_horizontalalignment (str in {'center', 'left', 'right'}, default: 'center')
  • figure.title_verticalalignment (str in {'top', 'center', 'bottom', 'baseline'}, default: 'top')

These follow the existing pattern used by axes.titlelocation (mpl._val_or_rc()). The _suplabels method now checks whether info['x0']/info['y0'] are strings (rcParams keys) or literals, so supxlabel/supylabel remain unaffected.

This only adds rcParams for suptitle; supxlabel and supylabel are left unchanged because they share figure.label_* keys but have different default positions (supxlabel y=0.01 vs supylabel y=0.5), which would create naming conflicts.

AI Disclosure

This PR was written with the assistance of AI (CodeBuddy agent). The AI was used to implement the code changes, write tests, and draft this PR description under the direction of the human author. All changes were reviewed and tested by the human author.

PR checklist

Release note

Add the following rcParams: figure.title_x, figure.title_y, figure.title_horizontalalignment, figure.title_verticalalignment. These control the default position and alignment of figure.suptitle().