2015-12-02 54 views
1

多發性個別地塊我試圖繪製使用內聯數據數據從行內文件:在gnuplot的

set xdata time 
set timefmt "%Y-%m-%dT%H:%M:%S" 
set format x "%H:%M:%S" 
set datafile separator ";" 
set yrange [0:] 
plot '-' index 0 using 1:2 with linespoints t 'before', '-' index 0 using 1:3 with linespoints t 'after' 
2015-11-05T00:42:32;0.690000;0.690000 
2015-11-05T00:43:34;0.690000;0.690000 
2015-11-05T00:44:35;0.690000;0.690000 
2015-11-05T00:45:36;0.690000;0.690000 
2015-11-05T00:46:37;0.690000;0.690000 
2015-11-05T00:47:38;0.690000;0.690000 
2015-11-05T00:48:38;0.690000;0.690000 
2015-11-05T00:49:40;0.690000;0.690000 
e 

gnuplot的 - 然而 - 抱怨沒有數據的第二部分。雖然重複數據如

set xdata time 
set timefmt "%Y-%m-%dT%H:%M:%S" 
set format x "%H:%M:%S" 
set datafile separator ";" 
set yrange [0:] 
plot '-' index 0 using 1:2 with linespoints t 'before', '-' index 0 using 1:3 with linespoints t 'after' 
2015-11-05T00:42:32;0.690000;0.690000 
2015-11-05T00:43:34;0.690000;0.690000 
2015-11-05T00:44:35;0.690000;0.690000 
2015-11-05T00:45:36;0.690000;0.690000 
2015-11-05T00:46:37;0.690000;0.690000 
2015-11-05T00:47:38;0.690000;0.690000 
2015-11-05T00:48:38;0.690000;0.690000 
2015-11-05T00:49:40;0.690000;0.690000 
e 
2015-11-05T00:42:32;0.690000;0.690000 
2015-11-05T00:43:34;0.690000;0.690000 
2015-11-05T00:44:35;0.690000;0.690000 
2015-11-05T00:45:36;0.690000;0.690000 
2015-11-05T00:46:37;0.690000;0.690000 
2015-11-05T00:47:38;0.690000;0.690000 
2015-11-05T00:48:38;0.690000;0.690000 
2015-11-05T00:49:40;0.690000;0.690000 
e 

做這項工作,我希望,這index 0已經選擇了正確的數據集。 我也試圖省略第二個「文件」名稱以再次使用最後一個文件。

有沒有更好的方式再次使用相同的內嵌數據而不重複?

回答

3

從版本5.0的gnuplot有一個新的「命名數據塊」結構(如定界符),它允許您一次保存聯數據和經常使用它,只要你想:

$data <<EOD 
2015-11-05T00:42:32;0.690000;0.690000 
2015-11-05T00:43:34;0.690000;0.690000 
2015-11-05T00:44:35;0.690000;0.690000 
2015-11-05T00:45:36;0.690000;0.690000 
2015-11-05T00:46:37;0.690000;0.690000 
2015-11-05T00:47:38;0.690000;0.690000 
2015-11-05T00:48:38;0.690000;0.690000 
2015-11-05T00:49:40;0.690000;0.690000 
EOD 

set xdata time 
set timefmt "%Y-%m-%dT%H:%M:%S" 
set format x "%H:%M:%S" 
set datafile separator ";" 
set yrange [0:] 
set style data linespoints 
plot $data using 1:2 t 'before', '' using 1:3 t 'after'