|
From: sfeam <sf...@us...> - 2017-08-02 16:04:35
|
On Wednesday, 02 August 2017 16:46:27 theozh wrote:
> ok... maybe I simply loop all the files
> "Data_<Index1>_<Index2>_<Index3>.dat"
> with respect to the first two indices and put them all in one list per
> plot. Additionally, in parallel I need to create a color list which
> corresponds to <Index2>.
> With this gnuplot checks [A...I] (9) x [a...f] (6) =54 times whether are
> files existing. Not very elegant, but seems feasible...
>
> Regular expressions in gnuplot might be nice e.g. to create sublists or
> define the color from the filenames...
>
> ### gnuplot code
> Index1 = [A B C D E F G H I]
> Index2 = [a b c d e f]
> ColorList = ""
> AllFileList = ""
>
> set multiplot layout 3,3
> do for [iii = 1:words(Index1)] {
> do for [jjj = 1:words(Index2)] {
> FileList = system('dir /B /S Data_'.Index1.'_'.Index2.'_'*.dat')
> do for [kkk = 1:words(FileList)] { ColorList = ColorList." ".jjj }
> AllFileList = AllFileList." ".FileList
> }
You are either inventing syntax that doesn't exist or mangling syntax
that does exist. I think your intent is something like
array index1 = ["A", "B", "C", "D", "E", "F", "G", "H", "I"]
file(i,j) = sprintf("%s_%d.dat", index1[i], j)
do for [iii = 1:|index1|] for [jjj = 1:*] {
plot file(i,j) with ... lc variable
}
I left out the color because it wasn't clear to me where it comes from,
but it sounds like you want to use it as a variable to color the lines
rather than as an element to loop over. So that would be something
involving "lc variable"
> unset multiplot
> ### end gnuplot code
> ### Still needs to be tested when several files are not existing.
missing files should not be a problem except that the iteration
[jjj = 1:*] will terminate at the first missing file. So if there are gaps
in the numbering you must give an explicit upper bound rather than *.
See for instance the second plot in
http://gnuplot.sourceforge.net/demo_cvs/iterate.html
At least that's the intent. If you find otherwise please report it as a bug.
Ethan
|