# [SciPy-user] multiple windows in gplt

krivilli at unberwoot.net krivilli at unberwoot.net
Thu Oct 14 20:40:18 CDT 2004

```> On Thu, 14 Oct 2004 19:27:59 -0500 (CDT), krivilli at unberwoot.net
> <krivilli at unberwoot.net> wrote:
>> -I did look your code again and there is another issue.
>>
>> -You should also notice that u're calling gplt.plot recursively from
>> time_series(), so it will pop-up a new window every time it's called
>> (different scopes).
>>
>
> I sometimes have matrix data that need to be plotted separately, so I
> dont have much choice but to recurse.
>
>> -What you could do is to plot 'just once', using a matrix. For example,
>> for a 2-D plot, say y(t) x t, u can store every new set of data in the
>> columns of matrix 't' (abscissas) and matrix 'y' (ordinates), and then
>> plot it ('t' and 'y' must have the same shape).
>>
>
> But I would still have to save them serially, wouldnt I? That is where
> the trouble arises, since the window gets disabled after saving.

-Yeah, but it's quite different efect when calling it (plot) from the same
scope:

def time_series(params,...):
# Build 'y' matrix and 't' matrix
.
.
.
# now we plot it
for i in iterator:
plot(x[:,i],y[:,i])
output("plot%d.ps" % i,'postscript color')
#u can call close(), no need though
close()

-This is different then use time_series() two times for two different data
sets. Something like:

class time_series(params,...):
def __init__():
.
.
.

def plot(data):
#same code for ploting here
.
.
.

MyClass =  time_series(foo,...)

MyClass.plot(data1)
MyClass.plot(data2)

-This isn't quite the same.

regards,

-- roberto

```