gnuplot 4.6以降で効率よくプロットするtip
ーーー結論ーーー
plot for [col=1:5] 'band.dat' using 1:(column(col)-1.121995) w l lw 2 lc rgb "#ff0000" notitle
ーーーーーーーー
以前は以下のようにいちいち書いててメンドくさかった。。
plot "band.dat" u 1:5 w l lw 2 lc rgb "#ff0000" notitle , "band.dat" u 1:6 w l lw 2 lc rgb "#ff 0000" notitle, "band.dat" u 1:7 w l lw 2 lc rgb "#ff0000" notitle
バージョン4.6以降はfor loopでスッキリ
plot for [col=1:5] 'band.dat' using 1:col w l lw 2 lc rgb "#ff0000" notitle
列の演算でusing 1:(col+1)
だと上手くいかないので調べたところcolumn(col)
と書けばよいみたい。
plot for [col=1:5] 'band.dat' using 1:(column(col)-1.121995) w l lw 2 lc rgb "#ff0000" notitle
以上、今回の備忘録。
Ref.
https://stackoverflow.com/questions/25380929/loops-in-gnuplot-inside-the-plot-command