[Top][All Lists]

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

gnuplot out fails to get sent to file

From: Phil Cummins
Subject: gnuplot out fails to get sent to file
Date: Wed, 6 Dec 2000 11:38:28 +0900


 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("",filename);
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
graw("set size 1,.5��n");
graw("set size 1,1��n");
graw("set term x11��n");
graw("set output ��n");

graw("set term x11��nset output��n");


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

        output is sent to STDOUT

%%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. If I remove the lines

graw("set term x11��n");
graw("set output ��n");

at the end the psfig function, I can finally get the postscript sent
to the file, but only if I run it twice (i.e., postscript finally gets 
written to the file the second time). I get similar behavior with 
the figfig() function recently posted to this list. 

Any suggestions gratefully appreciated. Thanks,

Phil R Cummins                                 address@hidden
Frontier Research for Subduction Dynamics  tel(i/d):81/0-468-67-3393
JAMSTEC, 2-15 Natsushima-cho               fax(i/d):81/0-468-67-3409
Yokosuka 237-0061, Japan            

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

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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