Gnuplot.py and, _by far_, the weirdest thing I've ever seen on my computer

Fernando Perez fperez.net at gmail.com
Wed Apr 6 00:37:02 EDT 2005


syd wrote:

> Thanks for all the help, guys!

> Fernando, that's a creative solution, I'll try it as well...
> while 1:
>   if os.path.isfile(your_plot_filename):
>     break
>   time.sleep(1)

More like a desperate brute force one, but it gets the job done :)  You
mentioned having ipython, so you can look in the Gnuplot2 module there, around
line 630.  You'll see the lengths ipython goes to to ensure that .eps files are
properly created if you call plot() with a filename argument.  That solution
has a cutoff, it tries 20 times and eventually gives up if it still doesn't
work.  You may want to implement something similar, to avoid endlessly waiting
for your plot in case there is a more serious problem preventing the file from
being created at all.

On a different note, you might want to check out matplotlib.  I held out as a
diehard gnuplot user for a long time, waiting for matplotlib to become
production ready (I've been using gnuplot since 1991!).  But mpl has really
matured recently, and it offers a level of sophistication and features that
gnuplot simply can't match.  Give it a try, you may like it.  I've moved my
production code to it, and couldn't be happier.  The gnuplot support will
remain in ipython for those who like it, but I won't be adding further features
to it (not that it has changed much in a while, as it's pretty solid).

best,

f




More information about the Python-list mailing list