[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
-------------------------------------------------------------