|
From: Ryan K. <rya...@gm...> - 2006-02-14 15:30:11
|
This is a common problem I have with switching code over to numpy. If you are in the habit of using if myMatrix: as a way to check for an empty matrix, numpy now throws this error. It could be replaced with myMatrix.any(), but then I think there are problems if you use the same code under Numeric or numarray. Ryan On 2/14/06, John Hunter <jdh...@ac...> wrote: > >>>>> "J" =3D=3D J Brandenburg <J.B...@if...> writes: > > J> Hi Travis, Hi list, > > J> I saw Travis' query on the matplotlib-user - list and of cause > J> I read Fernandos reply... > > J> So, I copied the three files into the matplotlib directory as > J> bsp_3D01.py, proj3d.py and mplot3d.py... But if I try to run > J> bsp_3d01.py I get: > > Not sure about the bsp example ... > > Try the following > > wget http://matplotlib.sourceforge.net/mpl3d.zip > unzip mpl3d.zip > cd 3d/ > python mplot3d.py --Numeric > > There is a problem with numpy support, since when I ran the code with > numpy I got the following > > Traceback (most recent call last): > File > "/home/jdhunter/debs/matplotlib/usr/lib/python2.4/site-packages/matplot= lib/backends/backend_gtk.py", > line 303, in expose_event > self._render_figure(self._pixmap, w, h) > File > "/home/jdhunter/debs/matplotlib/usr/lib/python2.4/site-packages/matplot= lib/backends/backend_gtkagg.py", > line 72, in _render_figure > FigureCanvasAgg.draw(self) > File > "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py", > line 386, in draw > self.figure.draw(renderer) > File "/usr/lib/python2.4/site-packages/matplotlib/figure.py", line > 528, in draw > for a in self.axes: a.draw(renderer) > File "mplot3d.py", line 714, in draw > self.w_xaxis.draw(renderer) > File "mplot3d.py", line 464, in draw > tc =3D self.axes.tunit_cube(vals,renderer.M) > File "mplot3d.py", line 680, in tunit_cube > M =3D M or self.M > ValueError: The truth value of an array with more than one element is > ambiguous. Use a.any() or a.all() > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi= les > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D103432&bid=3D230486&dat= =3D121642 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |