gnuplot中的直方图上的平滑线 [英] Smooth line on histograms in gnuplot
问题描述
我想在直方图上画一条平滑的线.到目前为止,我已经尝试了所有平滑函数,但无法获得结果.
I want to make a smooth line over histograms. So far I have tried all the smooth functions but I am not able to get the result.
对于我正在使用的直方图:
For the histograms I am using:
plot "file.scatter" u (hist($2,width)):(1.0) smooth freq w boxes notitle
,结果为:
但是当我要求gnuplot在上面绘制一条平滑线时:
But when I ask gnuplot to draw a smooth line over these:
plot "file.scatter" u (hist($2,width)):(1.0) smooth freq w l notitle
我得到:
我希望线图看起来像概率密度函数一样平滑(当然,这些值必须归一化).
I want the line plot to look smooth like a probability density function(of course the values will have to be normalized).
有任何线索专家吗?
推荐答案
您需要进行卷积,如果您使用的是gnuplot(> = 5.1)的最新版本,则可以使用kdensity
You need to do a convolution, if you have a recent version of gnuplot (>=5.1) you can plot with kdensity
plot $DATA smooth kdensity [bandwidth n] with boxes
请记住,最新版本的gnuplot也可以使用bins
功能对直方图进行合并.
Keep in mind that recent versions of gnuplot can also do the binning for the histogram with the bins
feature.
这篇关于gnuplot中的直方图上的平滑线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!