在下面的代码中,使用density=True
给出了概率密度函数,其曲线下的面积等于1。我想确保在y轴上得到的值大于1。在[0,1]范围内?即使在某些情况下曲线下的区域为1.00000002
,我也使用了类似的Ls数据。使用density=True
之后,我们能否获得大于1的值?
`Ls= np.array([0.28904281, 0.07674593 ,0.1602232 ,
0.91125812, 0.31972387, 0.44688592, 5.91075163
,0.52440172, 0.51376938, 0.16481705 ,0.35505426,
0.4354722, 5.79930666 ,0.19999694,
6.86172285, 0.44483234 ,0.30679022
,0.68441839,0.58445867 ,0.32532547, 0.3061434,
0.33319276, 0.26755858, 0.40010735,0.53881366
,0.07560947, 0.29215042, 0.39045618, 0.27220402,
0.8472669,0.11772259 ,0.20980161, 0.31013296,
0.60890591, 5.78487512, 0.5614211,0.36864035])
fig = plt.figure()
ax1 = fig.add_subplot(111)
hist,bin_edges,patches =
ax1.hist(Ls,bins=20,density=True)
print("hist: ",hist)
#hist: [1.67273235, 0.79653921, 0.15930784, 0., 0.,
#0.,0., 0.,0.,0., 0.,0.,0.,0.,0.,0.,0.15930784
#0.07965392,0.,0.07965392]`