On 23/04/2010 10:30 AM, williamol...@comcast.net wrote:
I use pylab.plot(x,y) for exploring or debugging some functions or
subroutines.
I would like to cycle through 2 or more plot windows, in a simple way
that won't force me to entangle the code in bothersome ways. But I
can't seem to get more than one plot window to open per launch.
Here is an example of what I want to have happen:
The program calls subroutine A, and creates a plot so that I can
see what it has done.
The plot opens, and I see that A is doing what I want, then I close
the plot window (I interactively click the close button).
Then the program calls subroutine B, and creates another plot so I
can check its results.
The plot opens, I see what I want and close it.
And so on.
But I can't figure out how to make that work. Only one plot ever shows.
Here is a very minimal example of what I have tried:
import numpy as N
import pylab as P
x = N.linspace(0,6,100)
y = N.sin(x)
P.plot(x,y)
P.show() # At this point, I want to see what I've got, and
then move on.
y = -y
P.plot(x,y)
P.show() # This plot will not show.
The answer for me is not to use "subplot()". I already use that
often. But I want these plots to stand on their own, so that I don't
have to entangle the different pieces of code just for some
exploratory plotting.
I hope someone has an easy solution!
Thanks,
Bill
Hi,
I gave a solution just a couple of days ago, I believe the similar
approach could solve this problem also
http://old.nabble.com/plotting-in-a-loop-td28306656.html
Essentially, . each time you press a button on graph (not the close
button) you generate an event which would call an update function, you
could farm out work to perform subroutine B here, then replot the result.
Steve
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users