2017-08-17 36 views
0

的Gnuplot組日期是我第一次使用的gnuplot和我的數據文件data.csv有以下內容由年/月

2017-05-28,50000 
2017-07-13,100 
2017-07-14,3217 
2017-01-23,2052 
2017-01-24,1954 
2017-01-25,1664 

現在我tryting使用以下設置

set title 'My First Graph' 
set ylabel 'Total per day' 
set xlabel 'Date' 
set grid 
set term png 
set datafile separator "," 
set output 'graph.png' 
set timefmt '%Y-%m-%d' 
set format x "%Y-%m" 
plot 'data.csv' 

繪製首先我得到一個line 10: Bad format character,我不明白

回答

1

您需要添加set xdata timeplot與指定兩列explic itly:

set title 'My First Graph' 
set ylabel 'Total per day' 
set xlabel 'Date' 
set grid 
set datafile separator "," 
set timefmt '%Y-%m-%d' 
set format x "%Y-%m" 
set xdata time 
plot 'data.csv' using 1:2 

enter image description here