|
From: Ethan M. <eam...@gm...> - 2014-12-17 23:11:35
|
On Wed, Dec 17, 2014 at 12:09 PM, dbrant <bra...@ho...> wrote: > Hi Gnuplotters > > For years i have used the following script taken from the Gnuplot In Action > book to generate my graphs: > > save "$0.gp" # Save commands to file > set t push # Save commands to file > set t png $1 # Store current terminal settings > # options from second argument > set o "$0.png" # Set output file name > replot # Generate plot > set o # Restore output to interactive terminal > set t pop # Restore interactive terminal settings > > This could be invoked as: > > call 'export.gp' 'myplot' 'size 160,100' > > With the advent of Gnuplot 5.0 this no longer works due to changes in > argument references from tokens $0 ... etc to string variables. > > Unfortunately i cannot get my head around it by way of examples i have seen. > > Could anyone please re-work the script to take recent developments into > account that i may understand use. > Regards, Dave script.gp: ~~~~~~ print "entering script ", ARG0 save ARG1 . ".gp" set term push set term png @ARG2 set output ARG1 . ".png" replot unset output set term pop I find the entire call mechanism ugly, however. I'd be more likely to do newplot = 'myplot' newsize = '160,100' load 'script.gp' script.gp: ~~~~~~ save newplot . ".gp" set term png size @newsize set output newplot . ".png" replot unset output unset term ~~~~~~ |