On Thu, 21 Jan 2016, Schaff, Frederik wrote:
Hello there,
I'd like to produce a bunch of customised graphs with gretl in a loop, where I fix
the axis ranges depending on values that I calculated beforehand. A minimum (not-) working
example is below.
-------
nulldata 240
series aa = normal(0,2)
series bb = 2^normal(0,2)
series cc = 3^normal(0,2)
scalar minx = min(bb)<min(cc)?min(bb):min(cc)
scalar maxx = max(bb)>max(cc)?max(bb):max(cc)
gnuplot aa bb --output="bb.png" { set xrange[$minx:$maxx]; }
gnuplot aa cc --output="cc.png" { set xrange[$minx:$maxx]; }
------
This does not work because one cannot pass $minx
String substitution (using @-variables) will work, as others have
said, but I'd encourage you to consider the more "disciplined"
approach of the (relatively new) "plot" command, as in:
<hansl>
list L = aa bb
plot L
printf "set xrange[%g:%g]", minx, maxx
end plot --output="bb.png"
list L = aa cc
plot L
printf "set xrange[%g:%g]", minx, maxx
end plot --output="cc.png"
</hansl>
Allin Cottrell