contourf3D and contour3D seem to be broken in my copy of matplotlib 
0.87.5 that I installed from ubuntu edgy's repositories. Is this a known 
problem? I started going through axes3d.py etc and fixing the reported 
errors, but the error trail seems to go pretty deep across multiple 
files. Now I'm wondering if maybe this is something major that has 
already been fixed by more experienced hands in SVN or something.

In the off chance that this is an unknown problem, I've enumerated the 
errors below. These all happened while attempting to run the example 
code in http://www.scipy.org/Cookbook/Matplotlib/mplot3D

If it's fixed in SVN, I'll try installing that, but I haven't seen this 
bug mentioned in matplotlib's bug list on sourceforge.net.

-- Matt

When I called contourf3D the first time, I got the following error:

<snip>
File "/usr/lib/python2.4/site-packages/matplotlib/axes3d.py", line 596, 
in contourf3D
    levels, colls = self.contourf(X, Y, Z, 20)
TypeError: unpack non-sequence
</snip>

As suggested in the examples page above, I went into contourf3D's 
function definition in axes3d.py and replaced:

    levels, colls = self.contourf(X, Y, Z, 20)

with

    C = self.contourf(X, Y, Z, *args, **kwargs)
    levels, colls = (C.levels, C.collections)

I then got a new error when calling contourf3D:

<snip>
exceptions.NameError                                 Traceback (most 
recent call last)

/home/mkg/Desktop/<ipython console>

/usr/lib/python2.4/site-packages/matplotlib/axes3d.py in 
contourf3D(self, X, Y, Z, *args, **kwargs)
    604             zs = [z1] * (len(linec._verts[0])/2)
    605             zs += [z2] * (len(linec._verts[0])/2)
--> 606             art3d.wrap_patch(linec, zs, fn=draw_polyc)
    607         self.auto_scale_xyz(X,Y,Z, had_data)
    608         return levels,colls

NameError: global name 'draw_polyc' is not defined
</snip>

After changing draw_polyc to art3d.draw_polyc, it complained that 
art3d.wrap_patch in fact only takes two arguments. So I changed

    art3d.wrap_patch(linec, zs, fn=draw_polyc)

to

    art3d.wrap_patch(linec, zs)

Which led to the latest error message:

<snip>
Traceback (most recent call last):
  File 
"/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py", 
line 284, in expose_event
    self._render_figure(self._pixmap, w, h)
  File 
"/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py", 
line 73, in _render_figure
    FigureCanvasAgg.draw(self)
  File 
"/usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py", 
line 391, in draw
    self.figure.draw(renderer)
  File "/usr/lib/python2.4/site-packages/matplotlib/figure.py", line 
538, in draw
    for a in self.axes: a.draw(renderer)
  File "/usr/lib/python2.4/site-packages/matplotlib/axes3d.py", line 
172, in draw
    Axes.draw(self, renderer)
  File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 1057, 
in draw
    a.draw(renderer)
  File "/usr/lib/python2.4/site-packages/matplotlib/art3d.py", line 56, 
in call_draw3d
    self.draw3d(renderer)
  File "/usr/lib/python2.4/site-packages/matplotlib/art3d.py", line 184, 
in draw3d
    xs,ys = zip(*self._offsets)
TypeError: zip() argument after * must be a sequence
</snip>

Contour3D (not contourf3D) does work in that it successfully displays a 
plot, but when I mouseover this plot, my python console fills with the 
following error message (one repetition for each mouse event):

<snip>
/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py in 
motion_notify_event(self, widget, event)
    178         # flipy so y=0 is bottom of canvas
    179         y = self.allocation.height - y
--> 180         FigureCanvasBase.motion_notify_event(self, x, y)
    181         return False  # finish event propagation?
    182

/usr/lib/python2.4/site-packages/matplotlib/backend_bases.py in 
motion_notify_event(self, x, y, guiEvent)
    885         event = MouseEvent('motion_notify_event', self, x, y, 
self._button, self._key, guiEvent=guiEvent)
    886         for func in self.callbacks.get('motion_notify_event', 
{}).values():
--> 887             func(event)
    888
    889     def draw(self, *args, **kwargs):

/usr/lib/python2.4/site-packages/matplotlib/axes3d.py in on_move(self, 
event)
    396         """
    397         #NOTE - this shouldn't be called before the graph has 
been drawn for the first time!
--> 398         if event.inaxes != self or not self.M:
    399             return
    400         #

ValueError: The truth value of an array with more than one element is 
ambiguous. Use a.any() or a.all()
</snip>




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to