2011-08-18 134 views
2

我的文件中讀取:如何用Gnuplot繪製線條圖?

user_number  diff id 
1    3  1 
1    4  1 
2    7  1 
359    8  1 
857    9  1 

下面是我使用的命令和所產生的誤差:

gnuplot> plot "avg_max_min.csv" using 1:2 with boxes 

             ^
Error:  warning: Skipping data file with no valid points 
                ^
      x range is invalid 

哪裏的錯誤來自任何想法?

+1

,它爲我工作。 –

+0

這是整個數據文件還是快照?我敢打賭,你要麼是缺少數據的問題(在你的文件中沒有指定),要麼是一個非常量字段分隔符(儘管我懷疑如果你的'csv'文件是從外部應用程序生成的話會發生這種情況。無論如何,請檢查'set datafile separator'和'set datafile missing'命令。 – chl

回答

3

讓它工作,你應該改變你的數據文件是

 
    #user_number  diff id 
    1    3  1 
    1    4  1 
    2    7  1 
    359    8  1 
    857    9  1 

的Gnuplot將把行以#開頭的註釋,並在不使用的情節。

2

正如其中一條評論指出的那樣,您提出的建議在最新版本的Gnuplot中沒有問題。

還有告訴gnuplot的開始處理第二行的文件,跳過第一的可能性:我測試了它

plot 'avg_max_min.csv' every ::2 using 1:2 with boxes