Hello Allin,
Indeed this is even better to handle. Thanks a lot!
-Frederik
-----Ursprüngliche Nachricht-----
Von: gretl-users-bounces(a)lists.wfu.edu [mailto:gretl-users-bounces@lists.wfu.edu] Im
Auftrag von Allin Cottrell
Gesendet: Freitag, 22. Januar 2016 01:52
An: Gretl list
Betreff: Re: [Gretl-users] [gnuplot] passing variables as arguments
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
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users