2015-12-16 23 views
1

我想使用gnuplot繪製圖。我想把這一天的時間放在X軸上。我設法做到這一點與下面的代碼:圖中未顯示使用gnuplot的線

set term postscript eps enhanced color "Times" 24 
set output "DailyAvailability.eps" 
set xtics rotate by -45 font ",18" 
set xdata time 
set timefmt '%Y-%m-%d %H' 
set format x '%H:%M' 
set ylabel "Number of peers" 
set xlabel "Time of the day [in hours]" 
set yrange [0:30] 
set xrange ['2015-12-30 15:50':'2015-12-30 16:00'] 
set key right top #FFA500" 
plot "intervals.dat" using 1:2 lc rgb "#000077" t "availability" w lines 

這是我的輸入數據

"2015-12-30 15:59" 6 
"2015-12-30 15:58" 10 
"2015-12-30 15:57" 17 
"2015-12-30 15:56" 18 
"2015-12-30 15:55" 19 
"2015-12-30 15:54" 20 
"2015-12-30 15:53" 18 
"2015-12-30 15:52" 28 
"2015-12-30 15:51" 23 

執行的代碼後,我得到的圖,但沒有在其繪製的線條。我嘗試閱讀其他問題,但我看不到他們的代碼和我的Gnuplot date/time in x axis之間的任何主要區別。我還檢查了輸入文件中的空格,但由於沒有錯誤或警告消息,我無法弄清楚發生了什麼。任何人都可以看到我在這裏失蹤了嗎?謝謝你的時間!

enter image description here

+0

@ F.Knorr給你真正的答案,一個解決方法是'陰謀「的時間間隔。 dat「使用0:2:xtic(substr(stringcolumn(1),12,16))lc rgb」#000077「t」availability「w lines' – vaettchen

回答

2

有兩個微小的失誤,使gnuplot的說

跳過數據文件,沒有有效點

  1. 你的時間格式缺少分鐘%M。因此%H應該是%H:%M
  2. 缺少您的時間格式的一部分引號。

的解決方案應該是這個樣子

set timefmt '"%Y-%m-%d %H:%M"' 

然後,我得到
enter image description here

+0

非常感謝!,解決了我的問題! –