|
From: <P...@dr...> - 2007-12-13 13:22:56
|
Hans-Bernhard Br=C3=B6ker wrote: > P=C3=A1draig Brady wrote: >> I tried to get a gnuplot script to read >> from stdin like a normal linux filter using plot '-' >=20 >> I know how to work around this but it's a horrible hack. >> I.E. rather than: >> gen_data | ./plot.gp > file.png >=20 > Without seeing what's in plot.gp, it's quite unclear what you're trying > to do here. What's wrong with the more conventional >=20 > gen_data | gnuplot plot.gp > file.png I want to read data on stdin and write png to stdout. I.E. behave like a standard unix filter which has lots of advantages. Here is an example plot.gpi script to do that: #!/usr/bin/env gnuplot set term png plot '-' However it doesn't work as shown below, as gnuplot drains its stdin on st= artup as detailed previously. It should not do that if possible. At least it sh= ould be a runtime rather than a compile time decision. Your variation above is= equivalent. $ seq 10 | ./plot.gpi > plot.png plot '-' "./plot.gpi", line 3: warning: Skipping data file with no valid points If you write the data to stdin after the plot command, then it works: (cat ./plot.gpi; seq 10) | gnuplot > plot.png Ethan's variant here is not as general as it hardcodes the source of the data within the script echo 'plot "< seq 10"' | GNUTERM=3Dpng gnuplot > plot.png thanks, P=C3=A1draig. |