Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > Gnuplot interactive function plotter > Re: How to paus...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 4 Topic 3420 of 3637
Post > Topic >>

Re: How to pause until plot window closed?

by Grant Edwards <grante@[EMAIL PROTECTED] > Jul 22, 2008 at 01:24 PM

On 2008-07-22, merritt@[EMAIL PROTECTED]
> wrote:
> In article <ns6dnf9ElM-yYhjVnZ2dnUVZ_jKdnZ2d@[EMAIL PROTECTED]
>,
> Grant Edwards  <grante@[EMAIL PROTECTED]
> wrote:
>>I want a shell script to plot a file and then allow the user to
>>manipulate the plot using the mouse (zoom, unzoom, etc.), and I
>>can't figure out how to do that.
>>
>>  gnuplot <<EOF
>>  plot "$$tmp.dat" with points
>>  pause -1
>>  EOF
>>
>>That exits immediately.
>>
>>If I replace the -1 with a large number (say, 9999), then the
>>plot window is unresponsive.   If I do a "pause mouse key", then
>>the plot window closes when the user tries to un-zoom.
>
> Make a separate subroutine file that loops on 'pause mouse key'.
>
>   pause mouse key
>   if (MOUSE_KEY != 27) reread
>
> The call it from the main script
>
>   print "Hit <esc> to exit"
>   load "loop_til_escape"

I tried that, and it doesn't work.  It appears to eat all of
the keypresses, so things like pressing "u" to unzoom don't
work.  Here's the rather ugly kludge I came up with:

#!/bin/bash

(cat<<EOF
plot sin(x)
pause -1 "press Ctrl-D to exit"
EOF
cat /dev/tty) | gnuplot

I don't like it much, but it works.


-- 
Grant Edwards                   grante             Yow! I'd like some JUNK
                                  at               FOOD ... and then I
want to
                               visi.com            be ALONE --
 




 4 Posts in Topic:
How to pause until plot window closed?
Grant Edwards <grante@  2008-07-22 10:39:27 
Re: How to pause until plot window closed?
merritt@[EMAIL PROTECTED]  2008-07-22 09:44:55 
Re: How to pause until plot window closed?
Grant Edwards <grante@  2008-07-22 13:24:49 
Re: How to pause until plot window closed?
merritt@[EMAIL PROTECTED]  2008-07-22 13:12:45 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 1:47:04 CST 2008.