Andi Clemens <[EMAIL PROTECTED]> writes:
>
> everytime I try to plot a bar with matplotlib I get the following
> error message:
> Traceback (most recent call last):
>   File "bar_stacked.py", line 13, in ?
>     p1 = bar(ind, menMeans,   width, color='r', yerr=womenStd)
>   File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line
> 1641, in bar
>     ret =  gca().bar(*args, **kwargs)
>   File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line
> 2485, in bar
>     xerr = asarray([xerr]*nbars, Float)
>   File "/usr/lib/python2.4/site-packages/Numeric/Numeric.py", line
> 134, in asarray
>     return multiarray.array(a, typecode, copy=0, savespace=savespace)
> TypeError: a float is required
>
>
> So I guess it has something to do with Numeric.py, but I can't figure
> out what the problem is. I tried to google but found nothing...
>
> Anyone has the same problem? I can plot all kinds of graphics with
> matplotlib, but the only type I'm interested in (bars) will not
> work.

It looks like it doesn't like not having xerr set. The documentation
says 

  xerr and yerr, if not None, will be used to generate errorbars on
  the bar chart

implying that if they are None (the default), then no errorbars will
be generated. But that doesn't seem to be the case. When I add an xerr
to both p1 and p2

  p1 = bar(ind, menMeans,   width, color='r', yerr=womenStd,
           xerr=zeros(N))
  p2 = bar(ind, womenMeans, width, color='y',
           bottom=menMeans, yerr=menStd, xerr=zeros(N))

I get the following bar chart

  http://img176.imageshack.us/my.php?image=imagenx6.png

with no errors.

Tim
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to