def resize_colobar(event):
    plt.draw()
posn = ax.get_position()
colorbar_ax.set_position([posn.x0 + posn.width + 0.01, posn.y0, 0.04, axpos
    .height])
fig.canvas.mpl_connect('resize_event', resize_colobar)
Correct placement of colorbar relative to geo axes (cartopy)