fig = plt.figure()
ax1 = fig.add_subplot(5, 4, 1)
ax2 = fig.add_subplot(5, 4, 2, sharex=ax1)
ax3 = fig.add_subplot(5, 4, 3, sharex=ax1, sharey=ax1)
Share axes in matplotlib for only part of the subplots