2013-04-14 83 views
0

我有以下結構文件:gnuplot的情節設置

#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 

,我想只有數據集開始,標題2繪製。

謝謝

回答

0

有了一個新的足夠的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 

產生以下情節:

enter image description here

請注意,只有第一行在最後繪製了點。

+0

非常感謝。真的很有幫助。如果我有超過1塊title2我想繪製? –