开发者

Superimpose gaussian shape on data plotted as histogram

does someone know as superimpose a gaussian curve over different bins of a histogram plot? My aim is to highlight the trend of data. Thanks. Lucio

My data (in % and saved in hist.dat) are:

EXP 0-10k 10-25k 25-50k 50-100k 100k
A 51.7 45 3 0.2 0.1
B 2.89 17.1 32 27 21
C 1.35 5.15 7.1 11.4 75

and commands to plot it are:

set boxwidth 0.75 absolute
set style fill solid 1.00 border -1
set style data histogram 
set style histogram cluster gap 1
set ylabel "Count of structures (%)"
set xlabel "Experimental methods"
plot 'hist.dat' using 2:xtic(1) title col, \
    '' using 3:xtic(1) title col, \
    '' using 4:xtic(1) title col, \
'' using 5:xtic(1) title col, \
    '' us开发者_开发问答ing 6:xtic(1) title col


You would define a function of the bell curve:

f(x) = (1 / s * sqrt(2 * pi)) * exp(- ((x - m) / s)**2 / 2)

Then use the fit command to fit it to your data points:

fit f(x) 'hist.dat' using 3:1 via m, s

I think that you will have to transpose your data file for that. I find that more sensible anyway, as I would not use a clustered histogram, but a multiplot:

set multiplot layout 1,3

fit is described in chapter 57, function and expression syntax in chapter 13, and multiplot in chapter 75.40 of the gnuplot manual (version 4.4).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜