Smooth line on histograms in gnuplot

余生颓废 提交于 2020-01-05 04:38:10

问题


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

and the result is:

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 get:

I want the line plot to look smooth like a probability density function(of course the values will have to be normalized).

Any clues experts?


回答1:


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

Keep in mind that recent versions of gnuplot can also do the binning for the histogram with the bins feature.



来源:https://stackoverflow.com/questions/44823631/smooth-line-on-histograms-in-gnuplot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!