'Remove subplot labels from multiple matplotlib.pyplot.psd and share common labels

Given the following code, I aim to represent a signal PSD along with PSDs for decimations of that signal in the same plot:

    fig, ax = plt.subplots(3, 1, sharex=True, sharey=True)
    fig.suptitle('Different degree curves')

    ax[0].set_title('PSD | Original')
    ax[0].psd(x, NFFT=M, Fs=fs)

    ax[1].set_title('PSD | Decimate_Factor=2')
    ax[1].psd(signal.decimate(x, 2), NFFT=M, Fs=fs)

    ax[2].set_title('PSD | Decimate_Factor=4')
    ax[2].psd(signal.decimate(x, 4), NFFT=M, Fs=fs)

    # fig.add_subplot(1, 1, 1, frame_on=False)
    # Hiding the axis ticks and tick labels of the bigger plot
    # plt.tick_params(labelcolor="none", bottom=False, left=False)

    # Adding the x-axis and y-axis labels for the bigger plot
    plt.xlabel('Common X-Axis')
    plt.ylabel('Common Y-Axis')

    # plt.tight_layout()
    plt.show()

However, even trying to following existing answers to remove the labels from each ax, etc. still leaves me with the following result:

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source