Re: [Tutor] Closing a matplotlib window after show()

2010-02-09 Thread Wayne Watson
Form me the solution is getting into interactive mode, which I had never 
heard of until this morning.


On 2/9/2010 9:04 AM, Wayne Watson wrote:
Well, you are correct. Finally, my latest post to the MPL list caught 
the eye of John Hunter. I think he wrote MPL. The way out is 
interactive use. One problem I've  had  with  Python packages they 
"seem" to based on some other

...

--
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Closing a matplotlib window after show()

2010-02-09 Thread Wayne Watson
Well, you are correct. Finally, my latest post to the MPL list caught 
the eye of John Hunter. I think he wrote MPL. The way out is interactive 
use. One problem I've  had  with  Python packages they "seem" to based 
on some other product, which one is supposed to know. I sight Tkinter 
and now MPL. I last used MatLab five years ago, and wrote some simple 
programs in it, so at least I have a very modest idea of how it works. I 
may have to use it to grsp the interactive mode.


This problem has been a difficult one get a grip on. I've had socket 
error problems, difficulty getting Matlab back up on my machine, a 
possible install problem,  and a host of ambiguities about this use. The 
end is near.


On 2/8/2010 9:53 PM, Wayne Watson wrote:
Hi, I'm not so sure that's true. I have a large 900 line program where 
some original plot code just continues beyond plot() and show(), after 
the user closes the plot window. New code that I put in gets knotted 
up, as far as I can tell. In both cases, I've put print statements 
after show(), but nothing appears in the shell or, if run  by clicking 
the program file, in the DOS-like window that appears.


Further, I posted this elsewhere, and someone claims to have tried a 
few simple examples with show() at the ended,and they did not get tied 
up in knots when the user closed the window. I'm going to assume he 
used IDLE, or a  straight execute of the file.


On 2/8/2010 2:23 PM, Eike Welk wrote:

Hello Wayne!

On Monday February 8 2010 20:54:27 Wayne Watson wrote:

The basic problem is the show(). One person checked out the examples I
provided and found show() to operate fine. On my XP machine the program
I'm modifying has plot code someone put in a year or two ago, and it 
all
works fine. My code produces the desired plot, but gets hung up on 
show().
The behavior that you describe, is the normal behavior of Matplotlib: 
When you

call show(), the program gets stuck.

Therefore the call to show is always the last statement in the example
programs. Show returns when the last plot window is closed, and in 
principle

the program could then continue.

If you want to look at plots while the program is running, you must use
Ipython. This is a modified Python interpreter, that contains special 
code to

change the way how Matplotlib works.

http://ipython.scipy.org/moin/


Eike.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor





--
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Closing a matplotlib window after show()

2010-02-09 Thread zhengqing gan
Hi,
recently I have the same problem with Matplotlib.
I wrote a wxpython program which can plot a graph when click a button.
When I click the button first time, I got the plot correct, but when I
closed the figure, and clicked the button again, the code crashed. I have to
reopen the program, and the same problem happened.
The solution is that put "import matplotlib.pyplot as plt"  before you
plot anything. Then everything works fine.
 I don't know why. It seems that when you close the figure, the imported
module or function stop working. It has to be imported every time.



On Tue, Feb 9, 2010 at 5:00 AM,  wrote:

> Send Tutor mailing list submissions to
>tutor@python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>http://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
>tutor-requ...@python.org
>
> You can reach the person managing the list at
>tutor-ow...@python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tutor digest..."
>
>
> Today's Topics:
>
>   1. python (ailx ailx)
>   2. Re: python (Luke Paireepinart)
>   3. Re: Closing a matplotlib window after show() (Wayne Watson)
>
>
> --
>
> Message: 1
> Date: Tue, 9 Feb 2010 10:54:06 +0800
> From: ailx ailx 
> To: tutor@python.org
> Subject: [Tutor] python
> Message-ID:
><5fc821071002081854k2fa92309ned9389b9f3d91...@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> python
> -- next part --
> An HTML attachment was scrubbed...
> URL: <
> http://mail.python.org/pipermail/tutor/attachments/20100209/a46c4683/attachment-0001.htm
> >
>
> --
>
> Message: 2
> Date: Mon, 8 Feb 2010 21:09:59 -0600
> From: Luke Paireepinart 
> To: ailx ailx 
> Cc: tutor@python.org
> Subject: Re: [Tutor] python
> Message-ID:
>
> Content-Type: text/plain; charset="iso-8859-1"
>
> quite.
>
> On Mon, Feb 8, 2010 at 8:54 PM, ailx ailx  wrote:
>
> > python
> >
> > ___
> > Tutor maillist  -  Tutor@python.org
> > To unsubscribe or change subscription options:
> > http://mail.python.org/mailman/listinfo/tutor
> >
> >
> -- next part --
> An HTML attachment was scrubbed...
> URL: <
> http://mail.python.org/pipermail/tutor/attachments/20100208/b19399fe/attachment-0001.htm
> >
>
> --
>
> Message: 3
> Date: Mon, 08 Feb 2010 21:53:39 -0800
> From: Wayne Watson 
> To: Eike Welk 
> Cc: tutor@python.org
> Subject: Re: [Tutor] Closing a matplotlib window after show()
> Message-ID: <4b70f863.1070...@sbcglobal.net>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi, I'm not so sure that's true. I have a large 900 line program where
> some original plot code just continues beyond plot() and show(), after
> the user closes the plot window. New code that I put in gets knotted up,
> as far as I can tell. In both cases, I've put print statements after
> show(), but nothing appears in the shell or, if run  by clicking the
> program file, in the DOS-like window that appears.
>
> Further, I posted this elsewhere, and someone claims to have tried a few
> simple examples with show() at the ended,and they did not get tied up in
> knots when the user closed the window. I'm going to assume he used IDLE,
> or a  straight execute of the file.
>
> On 2/8/2010 2:23 PM, Eike Welk wrote:
> > Hello Wayne!
> >
> > On Monday February 8 2010 20:54:27 Wayne Watson wrote:
> >
> >> The basic problem is the show(). One person checked out the examples I
> >> provided and found show() to operate fine. On my XP machine the program
> >> I'm modifying has plot code someone put in a year or two ago, and it all
> >> works fine. My code produces the desired plot, but gets hung up on
> show().
> >>
> > The behavior that you describe, is the normal behavior of Matplotlib:
> When you
> > call show(), the program gets stuck.
> >
> > Therefore the call to show is always the last statement in the example
> > programs. Show returns when the last plot window is closed, and in
> principle
> > the program could then continue.
> >
> > If you want to look at plots while the program is running, you must use
> > Ipython. This is a modified Python interpreter, that contains

Re: [Tutor] Closing a matplotlib window after show()

2010-02-08 Thread Wayne Watson
Hi, I'm not so sure that's true. I have a large 900 line program where 
some original plot code just continues beyond plot() and show(), after 
the user closes the plot window. New code that I put in gets knotted up, 
as far as I can tell. In both cases, I've put print statements after 
show(), but nothing appears in the shell or, if run  by clicking the 
program file, in the DOS-like window that appears.


Further, I posted this elsewhere, and someone claims to have tried a few 
simple examples with show() at the ended,and they did not get tied up in 
knots when the user closed the window. I'm going to assume he used IDLE, 
or a  straight execute of the file.


On 2/8/2010 2:23 PM, Eike Welk wrote:

Hello Wayne!

On Monday February 8 2010 20:54:27 Wayne Watson wrote:
   

The basic problem is the show(). One person checked out the examples I
provided and found show() to operate fine. On my XP machine the program
I'm modifying has plot code someone put in a year or two ago, and it all
works fine. My code produces the desired plot, but gets hung up on show().
 

The behavior that you describe, is the normal behavior of Matplotlib: When you
call show(), the program gets stuck.

Therefore the call to show is always the last statement in the example
programs. Show returns when the last plot window is closed, and in principle
the program could then continue.

If you want to look at plots while the program is running, you must use
Ipython. This is a modified Python interpreter, that contains special code to
change the way how Matplotlib works.

http://ipython.scipy.org/moin/


Eike.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

   


--
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Closing a matplotlib window after show()

2010-02-08 Thread Eike Welk
Hello Wayne!

On Monday February 8 2010 20:54:27 Wayne Watson wrote:
> The basic problem is the show(). One person checked out the examples I
> provided and found show() to operate fine. On my XP machine the program
> I'm modifying has plot code someone put in a year or two ago, and it all
> works fine. My code produces the desired plot, but gets hung up on show().

The behavior that you describe, is the normal behavior of Matplotlib: When you 
call show(), the program gets stuck. 

Therefore the call to show is always the last statement in the example 
programs. Show returns when the last plot window is closed, and in principle 
the program could then continue. 

If you want to look at plots while the program is running, you must use 
Ipython. This is a modified Python interpreter, that contains special code to 
change the way how Matplotlib works. 

http://ipython.scipy.org/moin/


Eike.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Closing a matplotlib window after show()

2010-02-08 Thread Wayne Watson
When I installed matplotlib2.5 on my W7 machine last were a few error 
msgs about missing about missing files. Is that usual for matplotlib. 
BTW, I've posted details of my problem to the MPL list. Here I'm 
interested in the basic of install and use with IDLE, and not the 
details of the use of MPL. Supposedly an uninstall is provided by a 
Python setup tool. I hae not used it yet.


The basic problem is the show(). One person checked out the examples I 
provided and found show() to operate fine. On my XP machine the program  
I'm modifying has plot code someone put in a year or two ago, and it all 
works fine. My code produces the desired plot, but gets hung up on show().


On 2/7/2010 8:11 PM, Wayne Watson wrote:
The code below is a typical example of matplotlib use. I've used it 
both in xp and win7 in IDLE. It produces the required plots and stop 
with the plot display. If I close the plot window with the x in the 
upper right corner,  the shell window is left open. I have to do the 
same to close it. If I run it again, and look at the shell window, it 
looks hung up with the cursor below the >>> prompt. Ctrl-c doesn't 
break it, and I have to resort to x again. There must be some 
mechanism to insert below that allows the program to continue on and 
thus complete. Supposedly fig.close() will but I've  put it in several 
places and have gotten unknown attribute to figure.

Comments?


from matplotlib.pyplot import figure, show
from numpy import arange, pi, cos, sin, pi
from numpy.random import rand

# unit area ellipse
rx, ry = 3., 1.
area = rx * ry * pi
theta = arange(0, 2*pi+0.01, 0.1)
verts = zip(rx/area*cos(theta), ry/area*sin(theta))

x,y,s,c = rand(4, 30)
s*= 10**2.

fig = figure()
ax = fig.add_subplot(111)
ax.scatter(x,y,s,c,marker=None,verts =verts)

show()






--
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Closing a matplotlib window after show()

2010-02-07 Thread Wayne Watson
The code below is a typical example of matplotlib use. I've used it both 
in xp and win7 in IDLE. It produces the required plos and stop with the 
plot display. If I close the plot window with the x in the upper right 
corner,  the shell window is left open. I have to do the same to close 
it. If I run it again, and look at the shell window, it looks hung up 
with the cursor below the >>> prompt. Ctrl-c doesn't break it, and I 
have to resort to x again. There must be some mechanism to insert below 
that allows the program to continue on and thus complete. Supposedly 
fig.close() will but I've  put it in several places and have gotten 
unknown attribute to figure.

Comments?


from matplotlib.pyplot import figure, show
from numpy import arange, pi, cos, sin, pi
from numpy.random import rand

# unit area ellipse
rx, ry = 3., 1.
area = rx * ry * pi
theta = arange(0, 2*pi+0.01, 0.1)
verts = zip(rx/area*cos(theta), ry/area*sin(theta))

x,y,s,c = rand(4, 30)
s*= 10**2.

fig = figure()
ax = fig.add_subplot(111)
ax.scatter(x,y,s,c,marker=None,verts =verts)

show()




--
My life in two words. "Interrupted Projects." -- WTW (quote originator)
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor