如何从gnuplot导出到extern数据文件用于生成直方图的频率计数?

Bru*_*ior 3 gnuplot histogram

为了绘制直方图,我按照行动中的Gnuplot一书使用

binc(bin_width,x) = bin_width * ( int(x/bin_width) + 0.5 )
Run Code Online (Sandbox Code Playgroud)

并绘制我使用的情节

plot 'datafile' u (binc(bin_width,$1)) : (1.0/size_sample ) smooth frequency
Run Code Online (Sandbox Code Playgroud)

我已经明白,平滑的频率可以为每个bin创建一个频率计数,这可以用于绘制直方图

但是,我如何创建一个包含频率的变量,我想这样做,例如,将每个bin的频繁计数值导出到一个文件中.

Sun*_* Jo 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
Run Code Online (Sandbox Code Playgroud)

您的直方图将保存在文件名"hist.dat"中.