How to know when gnuplot is finished

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to know when gnuplot is finished

Andy Adler-4
I want to write a script print.m to print graphics

_____________________________________________________________________
function print
% PRINT: print the current gnuplot window

outfile=sprintf('/tmp/oct-pr%dc',time);
gset term postscript
gset("output",['"' outfile '"'])
replot
gset term x11
replot
system(['lpr -r ' outfile]);
_____________________________________________________________________

The problem is that lpr gets launched before
gnuplot is finished.  I could always put in a delay
before the lpr, but that not the "Right thing to do(tm)"

So I'd like to know how to tell if gnuplot is finished
so I can launch lpr

thanks
_____________________________________________________________________
Andy Adler,    | Pulmonary Physiology Unit         | Lab 303-398-1626
[hidden email] | National Jewish Center,Denver,USA | Fax 303-398-1607

   For the Snark _was_ a Boojum, you see.    -Lewis Carroll


Reply | Threaded
Open this post in threaded view
|

Re: How to know when gnuplot is finished

Dirk Eddelbuettel-2

Andy,

It is actually easier to let gnuplot do more of the work. The next two lines
tell it to use postscript, and to send the result directly to the printer
spooler:

        gset terminal postscript
        gset output "|lpr"

In fact, what I use is a simple function 'replotps.m' which has the two lines
above plus the lines

        replot
       
        gset terminal x11
        gset output

That way, I can interactively work on a graph. Once I like it, this function
redirects the output to the printer, replots the graphs and resets the
defaults of X11 graphics.

Hope that helps, Dirk

--
 [hidden email]   http://rosebud.sps.queensu.ca/~edd   PGP KeyID 1024/6D7F08DD