2013-08-08 11 views
7

私は質問を通して見てきましたが、まだこの作業を行うことはできません。gnuplot複数の行とX軸の時間

私のデータセットは、このようなものです:

[date] , [%cpu] , [mem] 
23:00:39 , 21.9 , 2.1 
23:00:44 , 21.8 , 2.1 
23:00:49 , 21.8 , 2.1 
23:00:54 , 21.8 , 2.1 
23:00:59 , 21.7 , 2.1 

マイgnuplotの文がされ(これだけのデータを使用して開始):

set timefmt "%H:%m:%s" 
set xdata time 
set datafile sep ',' 
plot '/tmp/info' using 2 title 'cpu' with lines, '/tmp/info' using 3 title 'memory%' with lines 

私は、取得するには、次のエラー:

Need full using spec for x time data 

私はautoscale xを試しましたが、少し失われています。

答えて

2

あなたのplotコマンドは、この代わりに、次のようになります。

plot '/tmp/info' using 1:2 title 'cpu' with lines, '/tmp/info' using 1:3 title 'memory%' with lines 
5

時間データは、あなたが常に使用されるように、すべての列を指定する必要があります。 (注も補正timefmt):

set timefmt "%H:%M:%S" 
set xdata time 
set datafile sep ',' 
set style data lines 
plot '/tmp/info' using 1:2 title 'cpu', '' using 1:3 title 'memory%' 

この理由は、時間軸に使用されるデータは、2つの列から来ることができるようtimefmtは、スペースをも含むことができること、です。ここで(

set timefmt "%H:%M:%S %d/%m/%Y" 
set xdata time 
set format x "%H:%M:%S" 
set style data lines 
plot 'mydata.dat' using 1:3 t 'cpu', '' using 1:4 t 'memory%' 

混乱を避けるために、常に時間データのすべての列が描画スタイルで使用することを必要とされています。この形式のプロットコマンドがある

23:00:39 06/08/13 21.9 2.1 
23:00:44 06/08/13 21.8 2.1 
23:00:49 06/08/13 21.8 2.1 
23:00:54 06/08/13 21.8 2.1 
23:00:59 06/08/13 21.7 2.1 

:以下の変更されたデータファイルを考えてみましょうwith lines)は、usingステートメントで明示的に指定されています。

関連する問題