[SciPy-user] gnuplot.py

Fernando Perez Fernando.Perez at colorado.edu
Sat Aug 14 16:35:15 CDT 2004

Steve Schmerler wrote:

> you mean:
>     import Gnuplot
>     g=Gnuplot.Gnuplot()

It's a bit more than that, but hardly much at all:

import Gnuplot2 as Gnuplot

class NotGiven: pass

def gp_new(mouse=NotGiven,persist=NotGiven):
     """Return a new Gnuplot instance.

     The instance returned uses the improved methods defined in Gnuplot2.

     Options (boolean):

     - mouse: if unspecified, the module global gnuplot_mouse is used.

     - persist: if unspecified, the module global gnuplot_persist is used."""

     if mouse is NotGiven:
         mouse = gnuplot_mouse
     if persist is NotGiven:
         persist = gnuplot_persist
     g = Gnuplot.Gnuplot(persist=persist)
     if mouse:
         g('set mouse')
     return g

Note that Gnuplot2 is IPython's enhanced Gnuplot, with support for a few 
things the original lacks and which I find indispensable for efficient 
interactive use.

> Every 
>     g=Gnuplot.Gnuplot()
> kills the current wgnuplot.exe (I'm working on WinXP) as well as the current
> plot window and starts a new gnuplot session (new wgnuplot.exe). The problem
> is that I want to keep the former plot windows (I want them to appear one
> after the other).
> I've read read about the problems with Win on the IPython page. The function
> you've mentioned (gp_new()) is a pure IPython feature, right?

Yes, but you could either backtrack to ctypes 0.6, or just use the code above. 
  However, it's quite possible that the killing of wgnuplot also happens with 
this.  I don't have access to windows computers, so I can't test on the 
platform.  So I have no idea what will happen there.



More information about the SciPy-user mailing list