[SciPy-user] plot.plt speed
Douglas Eck
doug at idsia.ch
Fri Jun 7 05:28:02 CDT 2002
I found a solution to this problem, albeit not a perfect one.
Simply build a long plot string and then use eval()
That is:
x=rand(20,20000)
pltstr="plt.plot(";
for i in range(shape(x)[0]) :
pltstr = "%sy,x[%i,:]+%i,'b-'" % (pltstr,i,i)
if i<shape(x)[0]-1:
pltstr="%s," % (pltstr)
pltstr="%s)" % pltstr
print pltstr
eval(pltstr)
Maybe this isn't helpful to anyone else, but it was helpful for me.
Douglas Eck wrote:
> I need to plot 10 time series on the same plot window. But it's quite slow:
>
> plot.plt(rand(10,200))
> takes 18 seconds.
>
> plot.plt(rand(1,2000))
> takes less than one second
>
> There are some tricks for speeding up the first case in gnuplot by
> reshaping
> the array to be 1,2000 and adding a second array for the x values.
> [[1:200][1:200]....[1:200]]. But this has other problems.
>
> Any ideas? My timeseries are more on the order of (25,2500).... not
> pretty.
>
> Cheers,
> Doug
--
Dr. Douglas Eck, http://www.idsia.ch/~doug
Istituto Dalle Molle di Studi sull'Intelligenza Artificiale (IDSIA)
Neural Networks, Rhythm Perception and Production, Dynamical Systems
More information about the SciPy-user
mailing list