79768471

Date: 2025-09-18 13:08:33
Score: 1.5
Natty:
Report link

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')

colorbar with AxisDivider option

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: nish-ant