Hello list,
with the latest version of svn the pylab.hist command doesn't work if I use
align='center'. The error is due to a problem in the ax.bar - function as you
can see in the example below.
Probably width should be an array and not a list if one want to build
width/2..
I'm not sure what is the right solution, but I have two proposals:
- change line 3187 to left = left - npy.asarray(width)/2.0
- uncomment lines 3123-3126 in axes.py, but I don't know what will be
destroyed by that
thanks in advance for any help, best regards
Matthias
example - code :
In [1]: from numpy import ones, arange
In [2]: from pylab import axes
In [3]: ax = axes()
In [4]: ax.bar(arange(10), ones(10), width=0.8, bottom=None, align='center')
ยทยทยท
---------------------------------------------------------------------------
exceptions.TypeError Traceback (most recent
call last)
/home/michler/<ipython console>
/scratch/michler/SOFT/lib/python2.4/site-packages/matplotlib/axes.py in
bar(self, left, height, width, bottom, color, edgecolor, linewidth, yerr,
xerr, ecolor, capsize, align, orientation, log, **kwargs)
3185 elif align == 'center':
3186 if orientation == 'vertical':
-> 3187 left = left - width/2.
3188 elif orientation == 'horizontal':
3189 bottom = bottom-height/2.
TypeError: unsupported operand type(s) for /: 'list' and 'float'
/scratch/michler/SOFT/lib/python2.4/site-packages/matplotlib/axes.py(3187)bar()
3186 if orientation == 'vertical':
-> 3187 left = left - width/2.
3188 elif orientation == 'horizontal':
type(width)
<type 'list'>
width/2.
*** TypeError: unsupported operand type(s) for /: 'list' and 'float'