2011-08-26 18 views
3

要繪製的柱狀圖我按照書gnuplot的行動中,我使用如何從gnuplot輸出到extern數據文件用於生成直方圖的頻率計數?

binc(bin_width,x) = bin_width * (int(x/bin_width) + 0.5) 

,並繪製我用

plot 'datafile' u (binc(bin_width,$1)) : (1.0/size_sample) smooth frequency 

我已經認識到順利frecuency爲每個箱子一個frecuency計數,這例如,如何創建一個包含frecuency的變量,我想這樣做將每個bin的frecuency counts的值導出到一個文件中。

回答

7

通過設置table變量,您可以重定向繪圖並將其保存爲文本格式。

binc(bin_width,x) = bin_width * (int(x/bin_width) + 0.5) 
set table "hist.dat" 
plot 'datafile' u (binc(bin_width,$1)) : (1.0/size_sample) smooth frequency 
unset table 

您的直方圖將保存在文件名「hist.dat」中。