I had to use extend='min'
in using contourf
to include coloring the values below my given range (negative values). I'd like to ask if how do I crop this extended marker (pointed by the arrow)
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(5,5))
ax = plt.contourf(x, y, z, cmap='Spectral', vmin=0, vmax=60, norm=norm, extend='min')
# colorbar
cax = fig.add_axes([.918, 0.175, 0.045, 0.6])
cb = fig.colorbar(ax, cax=cax)
and make it to something like this
Thank you
You could use this code:
bounds = [5*i for i in range(13)]
cax = fig.add_axes([.918, 0.175, 0.045, 0.6])
fig.colorbar(mpl.cm.ScalarMappable(cmap = 'Spectral', norm = norm),
cax = cax,
ticks = bounds,
boundaries = [0] + bounds[1:-1] + [60])