On Wed, Feb 2, 2011 at 1:16 PM, Patton Bradford <patbradfo...@att.net>wrote:

> Just trying to get familiar with mplot3d's functions, and I've run into a
> problem with plot_wireframe that I'm having problems running down (or
> duplicating, for that matter).  I'm trying to generate plots of some wavelet
> functions, so I need to plot values against time and scale.  I've generated
> three numpy arrays: X (time), Y (scale) (generated these using meshgrid),
> and Z (values, a rather sparse matrix).  I verified that all of these are
> the same shape (7x100) by fetching the 'shape' attribute from X,Y,Z.
> However, when I call plot_wireframe(), I get this error:
>
> Exception in Tkinter callback
> Traceback (most recent call last):
>   File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__
>     return self.func(*args)
>   File
> "C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py", line
> 212, in resize
>     self.show()
>   File
> "C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py", line
> 215, in draw
>     FigureCanvasAgg.draw(self)
>   File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py",
> line 314, in draw
>     self.figure.draw(self.renderer)
>   File "C:\Python26\Lib\site-packages\matplotlib\artist.py", line 46, in
> draw_wrapper
>     draw(artist, renderer, *args, **kwargs)
>   File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 773, in
> draw
>     for a in self.axes: a.draw(renderer)
>   File "C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line
> 135, in draw
>     for col in self.collections]
>   File "C:\Python26\Lib\site-packages\mpl_toolkits\mplot3d\art3d.py", line
> 163, in do_3d_projection
>     self._segments3d]
>   File "C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\proj3d.py", line
> 211, in proj_trans_points
>     return proj_transform(xs, ys, zs, M)
>   File "C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\proj3d.py", line
> 193, in proj_transform
>     vec = vec_pad_ones(xs, ys, zs)
>   File "C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\proj3d.py", line
> 184, in vec_pad_ones
>     vec = np.array([xs,ys,zs,np.ones((len(xs)))])
> ValueError: setting an array element with a sequence.
>
> Any suggestions as to what the problem might be?  As I said, I'm having
> problems duplicating it in "toy" programs.
>
> Thanks in advance.
>
> /s/
> Pat
>
>
Pat,

plot_wireframe (and plot_surface as well) can be very tricky to use.
Typically, the way to go about it is through a parametric approach.  For
example, if I wanted a wireframe of a sphere, I would create two arrays of u
and v (azimuth and elevation) and use that to create x, y, z (assuming
constant r).  The key to making these surfaces work is that the order of the
array elements is very important because the plotting function uses this
information to link up neighboring points.

Could you please post a self-contained version of your code that
demonstrates the problem?

Ben Root
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to