|
From: Lou P. <lou...@ya...> - 2007-04-09 16:19:59
|
I assume you mean the first example, the wire frame
(see below). It works for me. No problems. When
pylab (matplotlib) plots it does so in a window
associated with a Python process that is separate from
the terminal (I assume you are using a terminal). You
might need to bring that process window to the
foreground.
Here's the code that worked for me:
from numpy import *
import pylab as p
import matplotlib.axes3d as p3
# u and v are parametric variables.
# u is an array from 0 to 2*pi, with 100 elements
u=r_[0:2*pi:100j]
# v is an array from 0 to 2*pi, with 100 elements
v=r_[0:pi:100j]
# x, y, and z are the coordinates of the points for
plotting
# each is arranged in a 100x100 array
x=10*outer(cos(u),sin(v))
y=10*outer(sin(u),sin(v))
z=10*outer(ones(size(u)),cos(v))
fig=p.figure()
ax = p3.Axes3D(fig)
ax.plot_wireframe(x,y,z)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
p.show()
--- Grant Edwards <gr...@vi...> wrote:
> I'm following the 3D plotting examples I found at
>
> http://www.scipy.org/Cookbook/Matplotlib/mplot3D
>
> The problem is that my program hangs when I call
> pylab.show(),
> it never returns: my program hangs.
>
> How do I show a 3D plot without hanging my program?
>
> --
> Grant Edwards grante
-- Lou Pecora, my views are my own.
---------------
"I knew I was going to take the wrong train, so I left early."
--Yogi Berra
____________________________________________________________________________________
Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front
|