[SciPy-user] Problem with titles/labels in gplt (and why is it so
sloooow?)
Grant Edwards
grante at visi.com
Thu Nov 18 16:33:35 CST 2004
I can't figure out how to get titles and labels to appear on
gplt output without having the plot re-drawn multiple times.
If I set the titles, etc. before the gplt.surf() command, they
don't show up. If I set them afterwards, the plot is re-drawn
everytime I set a label, title, key, etc.
gplot.surf() is already an order of magnitude slower than using
gnuplot-py, and when each plot has to be redraw a half-dozen
time times it's excruciating: a plot that should take a few
milliseconds ends up taking _seconds_ to complete.
I'm tempted to give up and just use gnuplot-py, except that
requires a lot more work to convert arrays into data objects.
What am I doing wrong that makes gplt so slow?
Why do I have to replot the surface 4 times to get the title
and axes labels?
Here's my test program:
------------------------------8<------------------------------
import sys,time,Gnuplot
from scipy import *
iterations = range(10)
x,y = mgrid[-1:1:20j,-1:1:20j]
z = (x+y)*exp(-6.0*(x*x+y*y))
gplt.current()._send('set mouse;')
t1 = time.time()
for i in iterations:
gplt.surf(x,y,z)
gplt.title("Sparsely sampled function -- iteration %d" % i)
gplt.xtitle("x")
gplt.ytitle("y")
gplt.ztitle("z")
t2 = time.time()
print t2-t1
gp = Gnuplot.Gnuplot()
t1 = time.time()
for i in iterations:
gp.title("Sparsely sampled function -- iteration %d" % i)
gp.set_label("xlabel","x")
gp.set_label("ylabel","y")
gp.set_label("zlabel","z")
gp.splot(Gnuplot.GridData(z,x[:,0],y[0,:],with='lines'))
t2 = time.time()
print t2-t1
sys.stdin.readline()
------------------------------8<------------------------------
The output is:
$ python testit.py
27.0858080387
0.360200166702
scipy.gplt is almost 100 times slower than gnuplot-py.
--
Grant Edwards
grante at visi.com
More information about the SciPy-user
mailing list