# Program hangs when I call pylab.show()

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 Yow! Is this where people
at are HOT and NICE and they

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 <grante@...1551...> 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...
http://games.yahoo.com/games/front

Hi,

The examples worked for me too, and I am using IDLE on Windows. And
isn't the program supposed to return control to the terminal even if
the Graph Window is in the background?

There may be something wrong. Can you post the exact code that you are
trying to run and the version numbers? I am not an expert, but it may
help.

--musically_ut

···

On 4/9/07, Lou Pecora <lou_boog2000@...9...> wrote:

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 <grante@...1551...> 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...
http://games.yahoo.com/games/front

-------------------------------------------------------------------------
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

--
Never trust a spiritual leader who cannot dance. ~Mr. Miyagi, The Next
Karate Kid