Re: [Matplotlib-users] plot_wireframe

2011-02-02 Thread Benjamin Root
On Wed, Feb 2, 2011 at 1:16 PM, Patton Bradford 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


[Matplotlib-users] plot_wireframe

2011-02-02 Thread Patton Bradford
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 --
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


[Matplotlib-users] plot_wireframe and Axes3D

2008-11-07 Thread Ryan Pavlovicz
Hi.  I am currently using *plot_wireframe* to create 3D wireframe images.
Is there any way to add a color gradient to these types of figures similar
to the image in this link: http://www.gams.com/solvers/matlab.gif ?  If this
cannot be accomplished with the *plot_wireframe* function, is there an
alternative method for creating 3D meshes that can have a color gradient?

Additionally, the tick labels on the 3D plots i am making intersect with the
frame of the plotting area.  Is there a way to add more space between the
plotting area and these ticks to clean up the image?

Thanks for your help,

ryan
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users