Following the response to another post, using AxisDivider fixes the colorbar placement.
contour = ax.contourf(x, y, val, cmap='gist_yarg', extend='max',
levels=np.linspace(0, 0.1, 200))
divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="6%", pad=0.06)
cbar = fig.colorbar(contour, cax=cax, format='%.2f')