0

I am making a bunch of colour plot figures in matplotlib and I want them all to have the same colour bar scale. At the moment it varies depending on the max/min value in my array and I can’t work out how to set a maximum and minimum value for the colourbar. I want to set the bounds between maximum of 0.8 and a minimum of 0.08. I want the format of 0.08 instead of 8e-02.

fig = plt.figure(figsize=(8, 8))
plt.title(title, fontsize=24)
plt.yticks(fontsize=12)
plt.xticks(fontsize=12)
modelmap = flopy.plot.ModelMap(model=mf)
lev_exp = np.arange(np.floor(np.log10(array.min())-1), 
np.ceil(np.log10(array.max())+1))
quadmesh = modelmap.plot_array(array,lev_exp, norm=colors.LogNorm())
cb = plt.colorbar(quadmesh, shrink=0.6, format='%.0e')
cb.ax.tick_params(labelsize=20)
Emma
  • 443
  • 2
  • 5
  • 13

1 Answers1

0

Try setting the limits with vmin=.08 and vmax=.8 inside your plotting function.

BenT
  • 3,172
  • 3
  • 18
  • 38