gnuplot - 在绘制为直方图的数据上叠加高斯形状

标签 gnuplot histogram gaussian

有人知道在直方图的不同区域上叠加高斯曲线吗?我的目的是突出数据的趋势。谢谢。卢西奥

我的数据(以%为单位并保存在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

最佳答案

您可以定义钟形曲线的函数:

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

然后使用 fit 命令将其适合您的数据点:

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

我认为您必须为此转置您的数据文件。无论如何,我发现这更明智,因为我不会使用聚类直方图,而是使用multiplot:

set multiplot layout 1,3

fit 在 gnuplot 手册(版本 4.4)的第 57 章中描述,函数和表达式语法在第 13 章中描述,multiplot 在 gnuplot 手册(版本 4.4)的第 75.40 章中描述。

关于gnuplot - 在绘制为直方图的数据上叠加高斯形状,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5996602/

相关文章:

image - GNUPLOT:试图提高质量

gnuplot - Octave opengl_renderer : Error 1286 occurred in init_gl_context

epslatex 终端中的 Gnuplot 符号,里面有点

c - 直方图,频率的计算

r - Plotly - 如何更改直方图颜色?

C++ 随机数没有改变

gnuplot - 如何将点削减到特定值以下

r - 有没有办法让 R 中的 density() 函数使用计数与概率?

c++ - OpenCV:期望最大化的预测函数的输出

MATLAB Murphy 的 HMM 工具箱