次の構造のファイルがあります。
#title
month graph1 graph2 graph3
January 1 2 3
February 2 3 4
#title2
month graph1 graph2 graph3
January 1 2 3
February 2 3 4
title2 で始まるデータセットのみをプロットしたいと思います。
ありがとうございました
十分に新しい gnuplot バージョンでは、名前を「インデックス」として指定できます。
plot 'datafilename' index 'title2'
古いバージョンの gnuplot では、これは比較的単純ですsed
:
plot "< sed '1,/#title2/d' datafile" using ...
データをプロットせずに停止する場合#title3
:
plot "< sed -n '/#title2/,/#title3/p' datafile" using ...
テストデータ -
#title
month graph1 graph2 graph3
January 1 2 3
February 2 3 4
#title2
month graph1 graph2 graph3
January 1 2 3
February 2 3 4
#title3
January 5 6 3
February 3 6 4.6
テスト スクリプト:
plot "< sed '1,/#title2/d' test.dat" using 2:4 w lines,\
"< sed -n '/#title2/,/#title3/p' test.dat" using 2:4 w p ps 5
このプロットを生成します:
最初の行だけが最後に点をプロットしていることに注意してください。