Hi,
I am trying to add a (configurable) colorbar to a an array which I simply plot with imshow().
Could anyone please help me how to enhance it with a colorbar?
import scipy,pylab
import matplotlib.cm as cm # colormaps
import matplotlib.colors as col # colormaps
dat = scipy.array([[1,2,3,4],[5,6,7,8]])
fig = pylab.figure()
ax = pylab.gca()
ax.set_title(‘the title’)
here’s chaos
#cmap = cm.get_cmap(‘rainbow’, 20) # 10 discrete colors
#ax.imshow(dat, cmap=cmap, interpolation=‘nearest’)
#fig.colorbar(dat)
#min,max = dat.min(),dat.max()
ax.imshow(dat,interpolation=‘nearest’)
pylab.show()
Thanks a lot in advance,
Daniel