gs = gridspec.GridSpec(2, 3, width_ratios=[10, 10, 1])
ax = np.empty([2, 3], dtype=np.object)
im = np.empty([2, 2], dtype=np.object)
for m in range(2):
    for n in range(2):
        ax[m, n] = plt.subplot(gs[m, n])
im[m, n] = ax[m, n].imshow(np.random.rand(10, 10))
for i in range(2):
    ax[i, 2] = plt.subplot(gs[i, 2])
plt.colorbar(im[i, 1], cax=ax[i, 2])
plt.show()
Matching graph sizes in matplotlib with and without make_axes_locatable->divider colorbars