|
From: theozh <th...@gm...> - 2017-08-04 11:30:31
|
Thank you, Ethan!
I learnt again a few things.
1. I shouldn't post code which is not fully tested
2. I wasn't yet aware of Arrays in gnuplot.
Actually, in my code it should have been a string and read Index1 = "A
B C D E F G H I"...
3. It's a good idea to create the filename via formula and sprintf()
So with your suggestions the following code looks compact and is tested
;-). Color is determined by <Index2>.
However, two issues:
1. The multiplot will not finish, e.g. when none of Data_E-files exist.
How to cope with this?
It looks like a threefold nested "for loop" is also possible. But how to
move on to the next multiplot and place "label 1 Data_<Index1>"
in every plot?
2. minor thing: Files with different <Index3> are just repeated
measurements of Data_<Index1>_<Index2> and do not need individual titles
in the key. How would it be possible to have just one per
Data_<Index1>_<Index2> per plot?
### start gnuplot code
# DataFile name scheme: Data_<Index1>_<Index2>_<Index3>.dat
# Plot all <Index1> into one plot
# Plot all <Index2> with same color
#
reset
set colorsequence classic
array Index1[9] = ["A", "B", "C", "D", "E", "F", "G", "H", "I"]
array Index2[6] = ["a", "b", "c", "d", "e", "f"]
MaxIndex3 = 3
FileName(i,j,k) = sprintf("Data_%s_%s_%d.dat",i,j,k)
set multiplot layout 3,3
do for [i=1:|Index1|] {
set label 1 sprintf("Data_%s",Index1[i]) at graph 0.05,0.9
plot for [j=1:|Index2|] for [k=1:MaxIndex3]
FileName(Index1[i],Index2[j],k) w l lc j title sprintf("%s",Index2[j])
}
unset multiplot
### end gnuplot code
|