|
From: Ethan M. <merritt@u.washington.edu> - 2007-03-16 19:42:49
|
On Friday 16 March 2007 08:00, Thomas Hartman wrote: > I have two commands, that it seems to me should have the same result: > a plot is opened with a postscript viewer. > > However, with one way the postscript output can be read, and with the > other it can't. > > I also show the diff of the output below. > > Is this as it should be, or a bug? Incorrect command issued from the bash prompt. This would have worked from csh/tcsh but you need to be more careful if you are using bash. Your command: cat save-sin.plt | gnuplot - > out-bad.ps Correct command: cat save-sin.plt | gnuplot > out-good.ps Note the important difference: If gnuplot sees "-" in the command line, it enters interactive mode and issues user prompts on stderr. Your bash command redirects both the user prompts (stderr) and the plot (stdout) into a file. > hartman@ds0207:~/learning/gnuplot>cat make-out-bad.sh > #!/bin/bash > outfile=out-bad.ps > rm -f $outfile > ( cat save-sin.plt | gnuplot - ) > out-bad.ps; > kghostview $outfile; > #rm $outfile > > hartman@ds0207:~/learning/gnuplot>cat make-out-good.sh > #!/bin/bash > outfile=out-good.ps > rm -f $outfile > ( gnuplot save-sin.plt ) > $outfile; > kghostview $outfile; > #rm $outfile > > hartman@ds0207:~/learning/gnuplot>cat save-sin.plt > # File name: save.plt - save a Gnuplot plot as a PostScript file > set terminal postscript portrait enhanced mono dashed lw 1 "Helvetica" 14 > plot sin(x) > > hartman@ds0207:~/learning/gnuplot>./compare-out-good-out-bad.sh > Terminal type set to 'postscript' > Options are 'portrait enhanced monochrome blacktext \ > dashed dashlength 1.0 linewidth 1.0 defaultplex \ > palfuncparam 2000,0.003 \ > butt "Helvetica" 14' > > 1c1 > < gnuplot> gnuplot> gnuplot> %!PS-Adobe-2.0 > --- > > %!PS-Adobe-2.0 > 3c3 > < %%CreationDate: Fri Mar 16 15:49:56 2007 > --- > > %%CreationDate: Fri Mar 16 15:49:54 2007 > 638c638 > < gnuplot> %%Trailer > --- > > %%Trailer -- Ethan A Merritt Courier Deliveries: 1959 NE Pacific Dept of Biochemistry Health Sciences Building University of Washington - Seattle WA 98195-7742 |