How to set color bar limits for tricontour plot?

133 views Asked by At

I would like to set my limits of the color bar on the right, the following code was used:

fig, (ax1) = plt.subplots(nrows=1, figsize=(8, 6), dpi=dpi, facecolor='w', edgecolor='k')

ax1.tricontour(x, y, c, levels=5, linewidths=0.5, colors='k')
cntr = ax1.tricontourf(x, y, c, levels=20, cmap="RdBu_r")

fig.colorbar(cntr, ax=ax1)
ax1.plot(x, y, 'ko', ms=3)
ax1.set(xlim=(-2, 10), ylim=(-2, 10))
ax1.set_title('Title')


plt.savefig('plot.png',dpi=dpi)
plt.show()

How the plot looks currently

I tried to ax1.set(clim=(0.45,4.5) and it did not work, along with variations of this code. Setting vmin and vmax also did not do the job.

0

There are 0 answers