From: Daniel M. <dan...@go...> - 2011-06-06 21:34:14
|
Hi all, I'd like to compare two sets of data by using subplots and imshow(). I have two issues with this: 1) how can I have a colorbar in each subplot? 2) how can I adjust the range limits for a colorbar, so that the comparison possible? Below is code which could serve as a starting point, I hope it helps to make my problem clearer... Thanks and best regards, Daniel import pylab #import matplotlib as mpl import matplotlib.cm as cm # colormaps #import matplotlib.colors as col # colormaps pylab.close('all') dat = pylab.array([[1,2,3,4],[5,6,7,8]]) datT = dat/2 fig = pylab.figure() ax1 = fig.add_subplot(211) ax1.set_title('raw data') im = ax.imshow(dat, interpolation='nearest', cmap=cm.get_cmap('rainbow', 20)) fig.colorbar(im) ax2 = fig.add_subplot(212) ax2.set_title('transformed') ''' here is missing: a 2nd colorbar with the same limit than in the first subfig, i.e. 1..8 ''' pylab.show() |