From: Ryan M. <rm...@gm...> - 2009-05-20 14:53:38
|
On Wed, May 20, 2009 at 3:17 AM, marcusantonius < mar...@st...> wrote: > > Hi everybody, > I have the problem, that I cannot add a color bar to a pcolor plot, which I > generate of some Data files. If I do > fig = plt.figure() > > plot1 = fig.add_subplot(231,aspect='equal') > plot1.pcolor(xsr) > plot1.axis([0, 127, 0, 127]) > plot1.colorbar() > > it just gives me > AttributeError: 'AxesSubplot' object has no attribute 'colorbar' > WARNING: Failure executing file: <test.py> > > What am I doing wrong? At the end of this file you find the whole plot-file Thanks for the full example, but if you carefully read the exception, it was telling you the problem. :) plot1 here is an axes object, which does not have a colorbar() method. Instead, you should change that to: plt.colorbar() Assuming everything else was working, you should be good to go with this change. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma Sent from Norman, Oklahoma, United States |