在绘制为直方图的数据上叠加高斯形状
有人知道在直方图的不同箱上叠加高斯曲线吗?我的目的是突出数据的趋势。谢谢。 Lucio
我的数据(以 % 为单位并保存在 hist.dat 中)是:
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
绘制它的命令是:
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, \
'' using 6:xtic(1) title col
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, \
'' using 6:xtic(1) title col
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以定义钟形曲线的函数:
然后使用 fit 命令将其拟合到您的数据点:
我认为您必须为此转置数据文件。无论如何,我发现这更明智,因为我不会使用聚类直方图,而是使用
multiplot
:fit
在第 57 章中描述,函数和表达式语法在第 13 章中描述,并且gnuplot 手册(版本 4.4)第 75.40 章中的multiplot
。You would define a function of the bell curve:
Then use the
fit
command to fit it to your data points: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
:fit
is described in chapter 57, function and expression syntax in chapter 13, andmultiplot
in chapter 75.40 of the gnuplot manual (version 4.4).