|
From: Geoff K. <ge...@ka...> - 2022-09-15 19:22:23
|
Dear gnuplot,
I would like to plot a sequence of arrays.
For example, I have a script:
plot-arrays.gp
# TEST PLOT ARRAYS
reset session
array ab1[3] = [ 1.1, 1.2, 1.3 ]
array ab2[3] = [ 2.1, 2.2, 2.3 ]
plot ab1 w lp, ab2 w lp
abname(i)=sprintf("%s%d", "ab", i)
do for [k=1:2]{ abk = abname(k); plot abk w lp }
# END
The first plot command works fine. But I have a large number of such
arrays and would like to proceed as in the second looped command.
But as things stand, the variable abk is treated as a file name and I
get the message:
gnuplot> call "plot-arrays.gp"
"plot-arrays.gp" line 11: warning: Cannot find or open file "ab1"
"plot-arrays.gp" line 11: No data in plot
I have experimented with macro substitution but not made any progress.
Is it possible to plot an array sequence?
I am using gnuplot 5.2 patchlevel 6, running under Debian Buster
--
Geoff
33 Ashbury Close, Cambridge CB1 3RW 01223 710582
|