|
From: sfeam <sf...@us...> - 2016-09-17 17:31:49
|
On Saturday, 17 September 2016 10:52:20 AM pl...@pi... wrote:
> Hi,
>
>
> the iteration in gnupllot is an excellent feature but can not take an
> irregular sequence of numerical variables.
>
> it's either a straight integer series or a list of _string_ variables.
>
>
> Is there any reason why it can not take a list of numbers ?
>
> eg. if I want vertical arrows at x= 11,13,17 it does not seem
> possible with the existing iteration.
>
>
> help tells me:
>
> Two forms of iteration clause are currently supported:
>
> for [intvar = start:end{:increment}]
> for [stringvar in "A B C D"]
>
>
>
>
> why not for [intvar = 11,13,17] ?
>
>
> is there a trick to a string value in set arrow ?
>
> set for [stringvar in "11 13 17"] arrow from ???, 0 to ???,1
Works for me:
gnuplot> set for [a in "11 13 17"] arrow from a,0 to a,1
gnuplot> show arrow
arrow 1, head nofilled back lt black linewidth 1.000 dashtype solid
from (11.0000, 0.00000, 0.00000) to (11.0000, 1.00000, 0.00000)
arrow 2, head nofilled back lt black linewidth 1.000 dashtype solid
from (13.0000, 0.00000, 0.00000) to (13.0000, 1.00000, 0.00000)
arrow 3, head nofilled back lt black linewidth 1.000 dashtype solid
from (17.0000, 0.00000, 0.00000) to (17.0000, 1.00000, 0.00000)
> Is there a problem to specify intvar with a list of values instead of a
> regular series?
In the development version you could use an array:
array list[3] = [11, 13, 17];
set for [i=1:3] arrow from list[i],0 to list[i],1
This could probably be extended a bit.
For example:
cleanly handling empty array slots,
allowing [1:*] to represent the full array,
promoting the array name into the iterator: for [i indexing array] ...
Ethan
|