<jupyter_start><jupyter_text>Align y-labelsTwo methods are shown here, one using a short call to `.Figure.align_ylabels`and the second a manual way to align the labels.<jupyter_code>import numpy as np
import matplotlib.pyplot as plt


def make_plot(axs):
    box = dict(facecolor='yellow', pad=5, alpha=0.2)

    # Fixing random state for reproducibility
    np.random.seed(19680801)
    ax1 = axs[0, 0]
    ax1.plot(2000*np.random.rand(10))
    ax1.set_title('ylabels not aligned')
    ax1.set_ylabel('misaligned 1', bbox=box)
    ax1.set_ylim(0, 2000)

    ax3 = axs[1, 0]
    ax3.set_ylabel('misaligned 2', bbox=box)
    ax3.plot(np.random.rand(10))

    ax2 = axs[0, 1]
    ax2.set_title('ylabels aligned')
    ax2.plot(2000*np.random.rand(10))
    ax2.set_ylabel('aligned 1', bbox=box)
    ax2.set_ylim(0, 2000)

    ax4 = axs[1, 1]
    ax4.plot(np.random.rand(10))
    ax4.set_ylabel('aligned 2', bbox=box)


# Plot 1:
fig, axs = plt.subplots(2, 2)
fig.subplots_adjust(left=0.2, wspace=0.6)
make_plot(axs)

# just align the last column of axes:
fig.align_ylabels(axs[:, 1])
plt.show()<jupyter_output><empty_output><jupyter_text>.. seealso::    `.Figure.align_ylabels` and `.Figure.align_labels` for a direct method    of doing the same thing.    Also :doc:`/gallery/subplots_axes_and_figures/align_labels_demo`Or we can manually align the axis labels between subplots manually using the`~.YAxis.set_label_coords` method of the y-axis object.  Note this requireswe know a good offset value which is hardcoded.<jupyter_code>fig, axs = plt.subplots(2, 2)
fig.subplots_adjust(left=0.2, wspace=0.6)

make_plot(axs)

labelx = -0.3  # axes coords

for j in range(2):
    axs[j, 1].yaxis.set_label_coords(labelx, 0.5)

plt.show()<jupyter_output><empty_output><jupyter_text>------------References""""""""""The use of the following functions, methods, classes and modules is shownin this example:<jupyter_code>import matplotlib
matplotlib.figure.Figure.align_ylabels
matplotlib.axis.Axis.set_label_coords
matplotlib.axes.Axes.plot
matplotlib.pyplot.plot
matplotlib.axes.Axes.set_title
matplotlib.axes.Axes.set_ylabel
matplotlib.axes.Axes.set_ylim<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13029465930018416, 'fraction_numerical': 0.03913443830570902, 'mean_word_length': 4.629533678756476, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '261108', 'license': 'MIT', 'n_tokens_mistral': 906, 'n_tokens_neox': 840, 'n_words': 179, 'path': 'matplotlib/gallery_jupyter/pyplots/align_ylabels.ipynb', 'repo_name': 'kingreatwill/penter', 'size': '2172'}