|
From: <sto...@ya...> - 2006-10-26 21:11:21
|
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
|
|
From: John H. <jdh...@ac...> - 2006-10-26 21:47:27
|
>>>>> "stochashtic" == stochashtic <sto...@ya...> writes:
stochashtic> I am brand spanking new to matplotlib and using
stochashtic> python for scientific computing (amazing product;
stochashtic> can't believe I didn't know about it before.) and
stochashtic> would appreciate some help in getting started. I
stochashtic> apologise if it's something basic (couldn't find
stochashtic> anything on google).
stochashtic> python 2.4.3 matplotlib 0.87.4 numarray-1.5.2
stochashtic> (Mandriva 2007 x64-64)
If you are using numarray, make sure your numerix setting in
matplotlibrc is
numerix : numarray
See http://matplotlib.sf.net/matplotlibrc
You can check your numerix setting by passing the --verbose-helpful
flag at the command line. You can also force numarray by passing
--numarray.
Eg
> python myscript.py --verbose-helpful --numarray
if this doesn't work, please post a complete example
JDH
|
|
From: Suresh P. <sto...@ya...> - 2006-10-26 22:16:12
|
The exception I posted is being thrown by numarray, so it is definitely
being used.
As I stated, it was thrown while executing one of the examples provided
with the matplotlib package:
#!/usr/bin/env python
# barchart_demo.py
# a bar plot with errorbars
from pylab import *
N = 5
menMeans = (20, 35, 30, 35, 27)
menStd = (2, 3, 4, 1, 2)
ind = arange(N) # the x locations for the groups
width = 0.35 # the width of the bars
p1 = bar(ind, menMeans, width, color='r', yerr=menStd)
womenMeans = (25, 32, 34, 20, 25)
womenStd = (3, 5, 2, 3, 3)
p2 = bar(ind+width, womenMeans, width, color='y', yerr=womenStd)
ylabel('Scores')
title('Scores by group and gender')
xticks(ind+width, ('G1', 'G2', 'G3', 'G4', 'G5') )
legend( (p1[0], p2[0]), ('Men', 'Women') )
#savefig('barchart_demo')
show()
Thanks,
Suresh
On Thu, 26 Oct 2006, JDH wrote:
>>>>>> "stochashtic" == stochashtic <sto...@ya...> writes:
>
> stochashtic> I am brand spanking new to matplotlib and using
> stochashtic> python for scientific computing (amazing product;
> stochashtic> can't believe I didn't know about it before.) and
> stochashtic> would appreciate some help in getting started. I
> stochashtic> apologise if it's something basic (couldn't find
> stochashtic> anything on google).
>
> stochashtic> python 2.4.3 matplotlib 0.87.4 numarray-1.5.2
> stochashtic> (Mandriva 2007 x64-64)
>
> If you are using numarray, make sure your numerix setting in
> matplotlibrc is
>
> numerix : numarray
>
> See http://matplotlib.sf.net/matplotlibrc
>
> You can check your numerix setting by passing the --verbose-helpful
> flag at the command line. You can also force numarray by passing
> --numarray.
>
> Eg
>
>> python myscript.py --verbose-helpful --numarray
>
> if this doesn't work, please post a complete example
>
> JDH
>
|
|
From: Suresh P. <sto...@ya...> - 2006-10-26 22:53:35
|
And yes my numerix is set to numarray as default:
$ python barchart_demo.py --verbose-helpful
...
numerix numarray 1.5.2
...
Thanks,
Suresh
On Thu, 26 Oct 2006, Suresh Pillai wrote:
> The exception I posted is being thrown by numarray, so it is definitely
> being used.
>
> As I stated, it was thrown while executing one of the examples provided
> with the matplotlib package:
>
> #!/usr/bin/env python
> # barchart_demo.py
> # a bar plot with errorbars
> from pylab import *
>
> N = 5
> menMeans = (20, 35, 30, 35, 27)
> menStd = (2, 3, 4, 1, 2)
>
> ind = arange(N) # the x locations for the groups
> width = 0.35 # the width of the bars
> p1 = bar(ind, menMeans, width, color='r', yerr=menStd)
>
> womenMeans = (25, 32, 34, 20, 25)
> womenStd = (3, 5, 2, 3, 3)
> p2 = bar(ind+width, womenMeans, width, color='y', yerr=womenStd)
>
> ylabel('Scores')
> title('Scores by group and gender')
> xticks(ind+width, ('G1', 'G2', 'G3', 'G4', 'G5') )
>
> legend( (p1[0], p2[0]), ('Men', 'Women') )
>
> #savefig('barchart_demo')
> show()
>
> Thanks,
> Suresh
>
|
|
From: Martin S. <sc...@ms...> - 2006-10-26 23:10:20
|
Suresh, That example works fine for me, using python 2.4.3, mpl 0.87.5 under windows, and wxPython 2.6.3.3, with backend: WxAgg, numerix: numarray (1.5.1), interactive: False, and axes.hold: True in the RC file. I'd recommend going with numpy instead of numarray, if you can. See http://numeric.numpy.org/ and http://scipy.org. Martin Suresh Pillai wrote: > The exception I posted is being thrown by numarray, so it is definitely > being used. > > As I stated, it was thrown while executing one of the examples provided > with the matplotlib package: > > #!/usr/bin/env python > # barchart_demo.py > # a bar plot with errorbars > from pylab import * > > N = 5 > menMeans = (20, 35, 30, 35, 27) > menStd = (2, 3, 4, 1, 2) > > ind = arange(N) # the x locations for the groups > width = 0.35 # the width of the bars > p1 = bar(ind, menMeans, width, color='r', yerr=menStd) > > womenMeans = (25, 32, 34, 20, 25) > womenStd = (3, 5, 2, 3, 3) > p2 = bar(ind+width, womenMeans, width, color='y', yerr=womenStd) > > ylabel('Scores') > title('Scores by group and gender') > xticks(ind+width, ('G1', 'G2', 'G3', 'G4', 'G5') ) > > legend( (p1[0], p2[0]), ('Men', 'Women') ) > > #savefig('barchart_demo') > show() > > Thanks, > Suresh > > On Thu, 26 Oct 2006, JDH wrote: > >>>>>>> "stochashtic" == stochashtic <sto...@ya...> writes: >> stochashtic> I am brand spanking new to matplotlib and using >> stochashtic> python for scientific computing (amazing product; >> stochashtic> can't believe I didn't know about it before.) and >> stochashtic> would appreciate some help in getting started. I >> stochashtic> apologise if it's something basic (couldn't find >> stochashtic> anything on google). >> >> stochashtic> python 2.4.3 matplotlib 0.87.4 numarray-1.5.2 >> stochashtic> (Mandriva 2007 x64-64) >> >> If you are using numarray, make sure your numerix setting in >> matplotlibrc is >> >> numerix : numarray >> >> See http://matplotlib.sf.net/matplotlibrc >> >> You can check your numerix setting by passing the --verbose-helpful >> flag at the command line. You can also force numarray by passing >> --numarray. >> >> Eg >> >>> python myscript.py --verbose-helpful --numarray >> if this doesn't work, please post a complete example >> >> JDH >> > > ------------------------------------------------------------------------- > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Eric F. <ef...@ha...> - 2006-10-27 03:57:43
|
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 sto...@ya... 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Suresh P. <sto...@ya...> - 2006-10-27 17:02:35
|
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 > |
|
From: Suresh P. <sto...@ya...> - 2006-10-27 21:45:25
|
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. :) 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 |