[IPython-user] Gnuplot.py v1.7 and mouse, one more thing

Fernando Perez fperez at colorado.edu
Tue Apr 20 00:42:03 CDT 2004


Hi all,

I found out that the 'fix' I suggested yesterday for Unix wasn't quite enough
to get the mouse properly working with Gnuplot.py 1.7.  While it works for
plots of string-specified functions (like in gp.plot('x**2')), it fails when
you supply arrays and try to zoom in.  The resulting error is something like:

In [2]: x=frange(0,2*pi,npts=200)

In [3]: plot x,sin(x)
------> plot(x,sin(x))

In [4]:
gnuplot> plot '/tmp/@14248.1' notitle
                ^
           can't read data file "/tmp/@14248.1"
           line 0: util.c: No such file or directory

where after input [3] I tried to zoom into the plot with the mouse.  I think
the problem stems from the use of pipes, in fact I had some old notes (from
2002) in ipython's changelog about this.

If I change line 87 of gp_unix.py from:

      prefer_fifo_data = 1

to
      prefer_fifo_data = 0

the above problem goes away.  It may be in fact possible to make the mouse and
FIFOs happily coexist, but I've never been able to.

Now that Gnuplot 4.0 with mouse support is officially out, this may become a
more common issue for users, so I figured it would be worth at least providing
   people with a temporary solution.  Perhaps Michael can find a cleaner,
permanent one, which maintains the advantages of FIFOs while keeping the mouse
features active (which are essential for those of us used to them: once you
get them, you don't want to go back :).

In summary, for users of Gnuplot.py v1.7: if you want full mouse support to
work under python as it does in a regular gnuplot session, a hackish fix is to:

1. Comment out line 188 of _Gnuplot.py
2. Set prefer_fifo_data=0 in line 87 of gp_unix.py

Best regards,

F.





More information about the IPython-user mailing list