hello,
the following script correctly plots the 2D exponential, but when I put my mouse on it, matplotlib sends this exception on the terminal :
···
---------------------------------------------------------------------------
exceptions.RuntimeError Traceback (most recent call last)
/usr/lib/python2.4/site-packages/matplotlib/backends/backend_qt.py in mouseMoveEvent(self, event)
119 # flipy so y=0 is bottom of canvas
120 y = self.figure.bbox.height() - event.y()
--> 121 FigureCanvasBase.motion_notify_event( self, x, y )
122 if DEBUG: print 'mouse move'
123
/usr/lib/python2.4/site-packages/matplotlib/backend_bases.py in motion_notify_event(self, x, y, guiEvent)
952 event = MouseEvent(s, self, x, y, self._button, self._key,
953 guiEvent=guiEvent)
--> 954 self.callbacks.process(s, event)
955
956 def draw(self, *args, **kwargs):
/usr/lib/python2.4/site-packages/matplotlib/cbook.py in process(self, s, *args, **kwargs)
81 self._check_signal(s)
82 for func in self.callbacks[s].values():
---> 83 func(*args, **kwargs)
84
85
/usr/lib/python2.4/site-packages/matplotlib/backend_bases.py in mouse_move(self, event)
1246 if event.inaxes and event.inaxes.get_navigate():
1247
-> 1248 try: s = event.inaxes.format_coord(event.xdata, event.ydata) 1249 except ValueError: pass
1250 except OverflowError: pass
/usr/lib/python2.4/site-packages/matplotlib/axes3d.py in format_coord(self, xd, yd)
375 #lines = [proj3d.line2d(p0,p1) for (p0,p1) in edges]
376 ldists = [(proj3d.line2d_seg_dist(p0,p1,p),i) for i,(p0,p1) in enumerate(edges)]
--> 377 ldists.sort()
378 # nearest edge
379 edgei = ldists[0][1]
RuntimeError: An array doesn't make sense as a truth value. Use any(a) or all(a).
the script is :
from pylab import *
import numarray as num
import matplotlib.axes3d as p3
x = num.arange(-3.,3.,0.01)
y = num.arange(-3.,3.,0.01)
X, Y = meshgrid(x,y)
Z = exp(-(X**2)-(Y**2))
fig=figure()
ax = p3.Axes3D(fig)
ax.contour3D(X,Y,Z)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
show()
Am I doing something wrong?
thanks,
Johann