【发布时间】:2013-04-14 00:36:01
【问题描述】:
我有以下结构的文件:
#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 开头的数据集。
谢谢
【问题讨论】:
我有以下结构的文件:
#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
产生这个情节:
请注意,只有第一行在末尾绘制了点。
【讨论】: