Show tick labels when sharing an axis in matplotlib

The ticks that are missing have had their visible property set to False. This is pointed out in the documentation for plt.subplot. The simplest way to fix this is probably to do:

for ax in axes.flatten():
    for tk in ax.get_yticklabels():
        tk.set_visible(True)
    for tk in ax.get_xticklabels():
        tk.set_visible(True)

Here I've looped over all axes, which you don't necessarily need to do, but the code is simpler this way. You could also do this with list comprehensions in an ugly one liner if you like:

[([tk.set_visible(True) for tk in ax.get_yticklabels()], [tk.set_visible(True) for tk in ax.get_yticklabels()]) for ax in axes.flatten()]

You can find extra information about labels of matplotlib here: https://matplotlib.org/3.1.3/api/_as_gen/matplotlib.axes.Axes.tick_params.html

In my case, I need to turn on all the x and y labels and this solution works:

for ax in axes.flatten():
    ax.xaxis.set_tick_params(labelbottom=True)
    ax.yaxis.set_tick_params(labelleft=True)

In Matplotlib 2.2 and above the tick labels can be turned back on using:

ax.xaxis.set_tick_params(labelbottom=True)