help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnuplot out fails to get sent to file


From: Mats Jansson
Subject: Re: gnuplot out fails to get sent to file
Date: Wed, 06 Dec 2000 09:23:18 +0100

Phil Cummins wrote:
> 
> Hello,
> 
>  I'm using octave-2.0.16 with gnuplot-3.8c. I have tried using
> the psfig function someone recently posted to this list, but have
> modified it slightly to use graw for sending commands to gnuplot.
> It's a very simple function which sets gnuplot's ouput to postscript
> and sends it to a file:
> 
> ## Usage: psfig(filename)
> ## Puts figure into ps file
> 
> function psfig(filename)
> 
> ## Add .ps if not there already
> if !index(filename,".")
>   filename = sprintf("%s.ps",filename);
> endif
> 
> graw(sprintf("set output ŠÜ"%sŠÜ"ŠÜn",filename));
> graw("show output;ŠÜn");  # What is the output now?
> graw("set style line 1 lw 5ŠÜn");
> graw("set style line 2 lw 5ŠÜn");
> graw("set style line 3 lw 5ŠÜn");
> graw("set style line 4 lw 5ŠÜn");
> graw("set style line 5 lw 5ŠÜn");
> graw("set style line 6 lw 5ŠÜn");
> graw("set style line 7 lw 5ŠÜn");
> graw("set terminal postscript portrait color ŠÜ"HelveticaŠÜ" 14ŠÜn");
> graw("show output;ŠÜn"); # And what is the output now? - should be the
> same...
> graw("set size 1,.5ŠÜn");
> graw("replotŠÜn");
> graw("set size 1,1ŠÜn");
> graw("set term x11ŠÜn");
> graw("set output ŠÜn");
> endfunction
> 
> graw("set term x11ŠÜnset outputŠÜn");
> replot;
> 
> endfunction
> 
> I put in the two graw("show outputŠÜn"); statements for
> debugging this problem. The output from this function
> looks like:
> 
> octave:350> psfig("fcplt");
> 
>         output is sent to 'fcplt.ps'
> 
>         output is sent to STDOUT
> 
> %!PS-Adobe-2.0
> %%Creator: gnuplot 3.8c patchlevel pm3d 6
> ...
> 
> followed by lots more postscript. My question is, why does the outout
> get set back to STDOUT before the postscript is sent? The psfig
> function tells gnuplot to set the output to a file, send the
> postscript to that file, and only after that reset the ouput to
> STDIN.

I found this in the gnuplot manual, (help set out). Maybe it helps. 

When both `set terminal` and `set output` are used together, it is
safest to
 give `set terminal` first, because some terminals set a flag which is
needed
 in some operating systems.  This would be the case, for example, if the
 operating system needs to know whether or not a file is to be formatted
in
 order to open it properly.

/Mats



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]