Hello everyone,
I am constructing a set of xy plots in a loop, using a predefined list of variables for the plots. I’d like the names of the plots to include the variables names. Here is a MWE, including some comments on what I tried
and did not work:
-------------------
#Loop through list of vars and create xy plots
nulldata 100
setobs 1 1 --cross-section
x_1 = uniform()
x_2 = uniform()
y_1 = uniform()
y_2 = uniform()
list xs = x*
list ys = y*
loop for (i=1; i<=nelem(xs); i++)
$i <- gnuplot xs[i] ys[i] #works
#printf "%s", varname(xs[i]) #works not -- error msg not of help
#string name = varname(xs[i]) #works not -- error msg indicates series ID needed
#string name = "@xs[i]" #works not either -- error msg not of help
string name = "name_$i" #works
@name <- gnuplot xs[i] ys[i] #works
endloop
-------------------
Any idea how I can make this work?
Kind Regards,
Frederik