|
From: Mark R. <mmr...@uc...> - 2006-01-02 02:31:16
|
I am trying to run gnuplot from within a fortran program that generates
results for plotting and is usually run interactively. I am trying to use
the SYSTEM call to first set up a fifo to pipe commands to gnuplot, and
then to run gnuplot itself. If I don't background the gnuplot invocation,
then the program halts at the gnuplot system command without producing any
plot to the screen. If I background gnuplot, then it appears that gnuplot
is invoked correctly and the piped commands are being interpretted by
gnuplot, but no plot to the screen is produced until the calling program
exits, at which point the gnuplot plot just flashes on the screen.
What I want is for the plot to display, and then when another command is
sent down the pipe, the new plot displays, just as in an interactive
gnuplot session.
Any suggestions would be most welcome. Thanks very much.
Mark Rashid
PS - here's a short test program which produces these behaviors:
program test
c
character ff*12, gp*25, cm1*19, cm2*19, rmf*8
c
ff = 'mkfifo fifo1'
call system (ff, istat1)
gp = 'gnuplot < fifo1 &'
call system (gp, istat2)
print *, 'istat1, istat2 = ', istat1, istat2
open (unit = 7, file = 'fifo1', status = 'unknown')
cm1 = 'plot sin(x) w l
'
cm2 = 'plot cos(x) w l
'
write (7, *) cm1
write (7, *) cm2
print *, 'AA'
read (5, *) inp
close (unit = 7)
rmf = 'rm fifo1'
call system (rmf, istat3)
stop
end
|