Re: PlottingArrays
Ethan Merritt <[email protected]> Thu, 15 Sep 2022 13:37:43 -0700
| Newsgroups | gmane.comp.graphics.gnuplot.user |
|---|---|
| Message-ID | <12200371.rMLUfLXkoz@stonelion> |
On Thursday, 15 September 2022 11:06:44 PDT Geoff Kaniuk wrote:
> 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.
See "help eval".
You want something like this
do for [k=1:N] {
command = sprintf("plot ab%d w lp", k)
eval(command);
}
Ethan
_______________________________________________
gnuplot-info mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info