2017-08-21 66 views
0

我有一個csv文件,如下所示,我想繪製S(在x軸上)和B(軸)。如何使用gnuplot生成線條圖。僅在gnuplot中繪製特定列

Test_Image,Original_Size 
    red-room.png,918394 
    Q,S,B,S,C,R 
    0,1021763,0.121086,0.00001459,-11.26,-222.18 
    1,1061763,0.125086,0.00001459,-11.26,-222.18 
    2,1051763,0.121086,0.00001459,-11.26,-222.18 
    3,1041763,0.121086,0.00001459,-11.26,-222.18 
    4,986461,0.151573,0.00003318,-7.63,-211.67 
    5,955766,0.160869,0.00005782,-4.07,-201.37 

基本上我需要一種方式告訴gnuplot忽略前3行並繪製第2和第3列。

回答

0

你需要告訴gnuplot的那場由逗號分隔,它應繪製列2和3:

set datafile separator comma 
plot "data.csv" using 2:3 w lp 

Gnuplot會自動忽略前三行。

0

,因爲它是在讀(不影響你的輸入文件)這樣你就可以修改數據:

plot 'awk -F, "NR>3{print $2,$3}" data.csv |' using ... 

那對打印領域的2線3,其中行數大於3的說,你的輸入文件data.csv

您可以用awk命令獨立實驗終端,以測試它的gnuplot外:

awk -F, 'NR>3{print $2, $3}' data.csv