plotgnuplot

gnuplot's plot for - missing curves


Following displays 4 curves, as expected:

    plot "a.csv"  using 1:2 lw 4 with lines, \
     ''       using 1:3 lw 4 with lines, \
     "b.csv"  using 1:2 lw 4 with lines, \
     ''       using 1:3 lw 4 with lines

However, the following displays only 3 curves:

plot for [flnm in "a.csv  b.csv"]     \
     flnm  using 1:2 lw 4 with lines, \
     ''    using 1:3 lw 4 with lines

What's the error in the "plot for" command?


Solution

  • The "for [xx=yy:zz]" only applies to the plot clause it introduces. You would need something like this

    plot for [flnm in "a.csv b.csv"] flnm  using 1:2 lw 4 with lines, \
         for [flnm in "a.csv b.csv"] flnm  using 1:3 lw 4 with lines
    

    or like this

    plot for [flnm in "a.csv b.csv"] for [col=2:3] \
         flnam using 1:col lw 4 with lines