Error with bar charts

I receive an error when trying to plot barcharts. To confirm it was nothing to do with my code, I tried running one of the demos provided and received the same error:

$ python barchart_demo.py
Traceback (most recent call last):
   File "barchart_demo.py", line 11, in ?
     p1 = bar(ind, menMeans, width, color='r', yerr=menStd)
   File "/usr/lib64/python2.4/site-packages/matplotlib/pylab.py", line 1641, in bar
     ret = gca().bar(*args, **kwargs)
   File "/usr/lib64/python2.4/site-packages/matplotlib/axes.py", line 2485, in bar
     xerr = asarray([xerr]*nbars, Float)
   File "/usr/lib64/python2.4/site-packages/numarray/numarraycore.py", line 434, in asarray
     return array(seq, type=type, typecode=typecode, copy=0, dtype=dtype)
   File "/usr/lib64/python2.4/site-packages/numarray/numarraycore.py", line 417, in array
     return fromlist(sequence,type,shape)
   File "/usr/lib64/python2.4/site-packages/numarray/numarraycore.py", line 267, in fromlist
     arr.fromlist(seq)
ValueError: Invalid sequence.

Can't figure out the issue in numarray it is encountering.

I am brand spanking new to matplotlib and using python for scientific computing (amazing product; can't believe I didn't know about it before.) and would appreciate some help in getting started. I apologise if it's something basic (couldn't find anything on google).

python 2.4.3
matplotlib 0.87.4
numarray-1.5.2
(Mandriva 2007 x64-64)

Thanks,
Suresh

Suresh,

This is baffling, and particularly annoying for someone just starting out with mpl. I don't think there is any problem with the barchart code--the demo works for me with numarray--and I don't see anything obvious in the traceback. Are your matplotlib and numarray both from Mandriva packages?

I would be inclined to download numpy and matplotlib as nice, fresh tarballs, uninstall any previous versions (including numarray), build and install numpy, and then do the same for matplotlib. If you have not done this before you will probably trip over some missing -devel packages (furnishing header files for python, gtk, etc), but once all that is straightened out it should go smoothly.

Eric

stochashtic@...483... wrote:

···

I receive an error when trying to plot barcharts. To confirm it was nothing to do with my code, I tried running one of the demos provided and received the same error:

$ python barchart_demo.py
Traceback (most recent call last):
   File "barchart_demo.py", line 11, in ?
     p1 = bar(ind, menMeans, width, color='r', yerr=menStd)
   File "/usr/lib64/python2.4/site-packages/matplotlib/pylab.py", line 1641, in bar
     ret = gca().bar(*args, **kwargs)
   File "/usr/lib64/python2.4/site-packages/matplotlib/axes.py", line 2485, in bar
     xerr = asarray([xerr]*nbars, Float)
   File "/usr/lib64/python2.4/site-packages/numarray/numarraycore.py", line 434, in asarray
     return array(seq, type=type, typecode=typecode, copy=0, dtype=dtype)
   File "/usr/lib64/python2.4/site-packages/numarray/numarraycore.py", line 417, in array
     return fromlist(sequence,type,shape)
   File "/usr/lib64/python2.4/site-packages/numarray/numarraycore.py", line 267, in fromlist
     arr.fromlist(seq)
ValueError: Invalid sequence.

Can't figure out the issue in numarray it is encountering.

I am brand spanking new to matplotlib and using python for scientific computing (amazing product; can't believe I didn't know about it before.) and would appreciate some help in getting started. I apologise if it's something basic (couldn't find anything on google).

python 2.4.3
matplotlib 0.87.4
numarray-1.5.2
(Mandriva 2007 x64-64)

Thanks,
Suresh

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Yes, both are mandriva packages:

python-matplotlib-0.87.4-2mdv2007.0
python-numarray-1.5.2-1mdv2007.0

Given there isnt a python-numpy package for x64-64 right now (there is a devel one, so not sure why no main package), I will go ahead and try to build from scratch.

Thanks,
Suresh

···

On Thu, 26 Oct 2006, Eric Firing wrote:

Suresh,

This is baffling, and particularly annoying for someone just starting out with mpl. I don't think there is any problem with the barchart code--the demo works for me with numarray--and I don't see anything obvious in the traceback. Are your matplotlib and numarray both from Mandriva packages?

I would be inclined to download numpy and matplotlib as nice, fresh tarballs, uninstall any previous versions (including numarray), build and install numpy, and then do the same for matplotlib. If you have not done this before you will probably trip over some missing -devel packages (furnishing header files for python, gtk, etc), but once all that is straightened out it should go smoothly.

Eric

Thanks for the support.

I uninstalled numarray, and then compiled/installed most recent numpy and matplotlib from the tarballs.

And I am happy to announce I can now perform the mundane task of plotting barcharts and histograms. :slight_smile:

Thanks again everyone,
Suresh

···

On Thu, 26 Oct 2006, Eric Firing wrote:

Suresh,

This is baffling, and particularly annoying for someone just starting out with mpl. I don't think there is any problem with the barchart code--the demo works for me with numarray--and I don't see anything obvious in the traceback. Are your matplotlib and numarray both from Mandriva packages?

I would be inclined to download numpy and matplotlib as nice, fresh tarballs, uninstall any previous versions (including numarray), build and install numpy, and then do the same for matplotlib. If you have not done this before you will probably trip over some missing -devel packages (furnishing header files for python, gtk, etc), but once all that is straightened out it should go smoothly.

Eric