Friends,
I tried to incorporate an example script for colorbar given in the following
link into my code.
http://matplotlib.sourceforge.net/examples/api/colorbar_only.html
When i run the program, i get the following error. I didnt use set_ylabel
option in my code. I am not getting why this error appears. Kindly help me
by writting why this error comes. I have attached the code with the mail.
Thanks,
Bala
Traceback (most recent call last):
File "./test.py", line 27, in <module>
cb = mpl.colorbar.ColorbarBase(map,
cmap=cmap,norm=norm,boundaries=[0]+bound+[9],extend='both',ticks=boun
File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 221,
in __init__
self.set_label('')
File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 302,
in set_label
self._set_label()
File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 292,
in _set_label
self.ax.set_ylabel(self._label, **self._labelkw)
AttributeError: 'AxesImage' object has no attribute 'set_ylabel'
#!/usr/bin/env python
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
# user input section, input file and bound range
data=np.loadtxt('test.rms')
# figure creation
fig = plt.figure(figsize=(4,4))
ax = fig.add_subplot(111)
ax.set_xlim([0,100])
ax.set_ylim([0,100])
ax.set_xticks(range(0,100,200))
ax.set_yticks(range(0,100,200))
bound=[1.5,2.5,4,5]
cmap = mpl.colors.ListedColormap(['r', 'g', 'b'])
cmap.set_over('0.25')
cmap.set_under('0.75')
norm = mpl.colors.BoundaryNorm(bound, cmap.N)
map=ax.matshow(data[0:100,0:100],origin='lower')
cb = mpl.colorbar.ColorbarBase(map, cmap=cmap,norm=norm,boundaries=[0]+bound+[9],extend='both',ticks=bound)
plt.show()
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users