[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PostScript print function
From: |
John Logsdon |
Subject: |
Re: PostScript print function |
Date: |
Wed, 24 Jun 1998 09:08:00 +0100 (BST) |
Just a point to add that if the plot is very large, you cannot remove the
file at the end of the script since it is still be piped to. (Please
excuse the preposition at the end).
On my (by now) slow 486/100 and 586/133, which have done a mountain of
Octaving in the last year, I use the function below that also prompts for
a filename if it is not given (hence enabling you to store the files for
LaTeX etc work later).
I have therefore added an optional sleep to enable the process to be
completed and also to enable the preparation of postscript files alone
since there are times when I don't want to occupy my printer either!
No doubt there are more elegant ways of skinning this cat ...
John
Centre for Applied Statistics
Lancaster University
function [_plotname]=printplot(filename,sl)
%
% function [_plotname]=printplot(filename,sl)
% Function to plot a file on the screen
% if sl>0 then it sleeps for sl seconds
% if sl<0 then no printing is done, only a postscipt file prepared
%
if nargin<1
_plotname=input("Enter name of file to store data in ","s");
else
_plotname=filename;
end
gset term postscript
eval(["gset output """,_plotname,""""]);
replot
if nargin==1
sl=0;
end
if sl>0
message = sprintf("Sleeping for %d seconds ...\n",sl)
sleep(sl);
end
gset term X11;
replot;
if sl>=0
eval(["system(""lpr ",_plotname,""");"]);
end
endfunction