2016-01-17 19 views
2

我有一個由空格分隔的列的數據集。該列按此順序爲「年月日小時數據」。gnuplot時間格式變量用空格分隔

我嘗試過幾種時間格式,例如「%Y%m%d%H」,「%Y%m%d%k」,「%Y%m%d%k」但它們不起作用。我認爲這是因爲列更改了數字的位數。

這是哪種適合這種數據的時間格式?

下面是一個數據集的例子。

2002 12 31 9 65 
    2002 12 31 10 60 
    2002 12 31 11 56 
    2002 12 31 12 50 
    2002 12 31 13 45 
    2002 12 31 14 38 
    2002 12 31 15 45 
    2002 12 31 16 50 
    2002 12 31 17 47 
    2002 12 31 18 44 
    2002 12 31 19 40 
    2002 12 31 20 32 
    2002 12 31 21 35 
    2002 12 31 22 40 
    2002 12 31 23 33 
    2003 1 1 0 28 
    2003 1 1 1 25 

這裏是我的代碼:

 set xdata time 
    set timefmt "%Y%m%d%k" 
    plot "datafile.dat" using 1:2 
    set terminal png enhanced 
    set output "series.png" 
    replot 

回答

1

有在你空間的日期是好的,你只能正確計算列:你的數據是在第五列,不管多少列消耗by the timefmt:

set xdata time 
set timefmt "%Y %m %d %H" 
plot "datafile.dat" using 1:5 

timefmt中的單個空格與數據中的一個或多個空格匹配。