[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
printing graphs automatically from Oct1.1.1
From: |
John Beale |
Subject: |
printing graphs automatically from Oct1.1.1 |
Date: |
Thu, 15 Jun 1995 00:46:07 PDT |
I find the many commands needed in Octave 1.1.1 to switch Gnuplot to
"postscript", output to "file" etc. annoying, so I wrote the "print.m"
command as included below. I only just got Octave last week so I'm not
writing clean code, eg using a local variable or even clearing the variable
afterwards.
It would be nice to check that a plot actually exists, since if replot
fails, the code will exit with terminal still set to postscript and the
output redirected, a bad thing. Also, how do I check which kind of
terminal is currently set so I can reset it at the end? Does anyone know?
thanks,
-john
John Beale ------------------------- address@hidden
-------------------------- http://www-leland.stanford.edu/~beale
# -------------------------------------------------------
# Octave .m file to print image on lpr
# For some reason, set output "|lpr" doesn't work on my system,
# so I use a temporary file and a system call, which does work.
# (Octave v1.1.1 and Gnuplot v3.5 pl3.50.1.17 on DEC-Ultrix-4.2a)
# John P Beale 6/14/95
function print()
ttemp_zz = automatic_replot;
aa_zz = ["automatic_replot = \"false\";"];
eval(aa_zz);
# aa_zz = ["show terminal"];
# string = eval(aa_zz);
# hmm, how to get current terminal setting? ohwell.
aa_zz = ["set terminal postscript"];
eval(aa_zz);
# set output to filename
fname_zz = octave_tmp_file_name;
aa_zz = ["set output \"", fname_zz, "\"" ];
eval(aa_zz);
replot;
# print file
aa_zz = ["system(\"lpr ",fname_zz,"\")"];
eval(aa_zz);
# clean up file afterwards
aa_zz = ["system(\"rm -f ",fname_zz,"\")"];
eval(aa_zz);
aa_zz = ["automatic_replot = \"",ttemp_zz,"\";"];
eval(aa_zz);
aa_zz = ["set terminal x11"];
eval(aa_zz);
endfunction
- printing graphs automatically from Oct1.1.1,
John Beale <=