On Wed, May 20, 2009 at 10:04 AM, John Hunter jdh2...@gmail.com wrote:
On Wed, May 20, 2009 at 9:53 AM, Ryan May rma...@gmail.com wrote:
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.
It looks like Markus is trying to use the API, so rather than suggest
the pyplot colorbar method, I suggest using the figure instance
method. Markus the pyplot method plt.colorbar is a thin wrapper
around the figure method fig.colorbar -- see also:
http://matplotlib.sourceforge.net/faq/usage_faq.html#matplotlib-pylab-and-pyplot-how-are-they-related
http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure.colorbar
It may be a good idea and refer to the return value of fig.add_subplot
as ax or something that, rather than plot1 because add_subplot
returns an Axes instance and thus ax is a better mnemonic; see
http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure.add_subplot
So I suggest something like::
fig = plt.figure()
ax1 = fig.add_subplot(231,aspect='equal')
ax1.pcolor(xsr)
ax1.axis([0, 127, 0, 127])
fig.colorbar()
Except that it won't work like that. :) (I actually tried that the first
time) You need to give Figure.colorbar() the mappable as the first
argument. So this would then become:
ax1 = fig.add_subplot(231,aspect='equal')
pc = ax1.pcolor(xsr)
ax1.axis([0, 127, 0, 127])
fig.colorbar(pc)
Ryan
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users