matplotlib.figure.Figure.align_ylabels#

Figure.align_ylabels(axs=None)[source]#

Align the ylabels of subplots in the same subplot column if labelalignment is being done automatically (i.e. the label position isnot manually set).

Alignment persists for draw events after this is called.

If a label is on the left, it is aligned with labels on Axes thatalso have their label on the left and that have the sameleft-most subplot column. If the label is on the right,it is aligned with labels on Axes with the same right-most column.

Parameters:
axslist ofAxes

Optional list (orndarray) ofAxesto align the ylabels.Default is to align all Axes on the figure.

Notes

This assumes that all Axes inaxs are from the sameGridSpec,so that theirSubplotSpec positions correspond to figure positions.

Examples

Example with large yticks labels:

fig,axs=plt.subplots(2,1)axs[0].plot(np.arange(0,1000,50))axs[0].set_ylabel('YLabel 0')axs[1].set_ylabel('YLabel 1')fig.align_ylabels()

Examples usingmatplotlib.figure.Figure.align_ylabels#

Align labels and titles

Align labels and titles