matplotlib 直方图概率不为1

myarray = np.random.random(100)
results, edges = np.histogram(myarray, normed=True)
binWidth = edges[1] - edges[0]
plt.bar(edges[:-1], results*binWidth, binWidth)

https://stackoverflow.com/questions/3866520/how-can-i-plot-a-histogram-such-that-the-heights-of-the-bars-sum-to-1-in-matplot/31486808#31486808?newreg=36e132288d1c4f22a13dbfa97ec2587a

如果觉得文章不错,可以分享给其他人哟~
原文地址:https://www.cnblogs.com/hany-postq473111315/p/15342128.html