3d plot examples

Hi Travis, Hi list,

    > I saw Travis' query on the matplotlib-user - list and of cause
    > I read Fernandos reply...

    > So, I copied the three files into the matplotlib directory as
    > bsp_3D01.py, proj3d.py and mplot3d.py... But if I try to run
    > 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/matplotlib/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/matplotlib/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 = self.axes.tunit_cube(vals,renderer.M)
  File "mplot3d.py", line 680, in tunit_cube
    M = 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 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 <jdhunter@...4...> wrote:

    > Hi Travis, Hi list,

    > I saw Travis' query on the matplotlib-user - list and of cause
    > I read Fernandos reply...

    > So, I copied the three files into the matplotlib directory as
    > bsp_3D01.py, proj3d.py and mplot3d.py... But if I try to run
    > 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/matplotlib/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/matplotlib/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 = self.axes.tunit_cube(vals,renderer.M)
  File "mplot3d.py", line 680, in tunit_cube
    M = 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 files
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=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Ryan Krauss wrote:

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.

sometrue() exists as a ufunc in both.

···

--
Robert Kern
robert.kern@...287...

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
  -- Richard Harter