pylab.hist(diff, bins=100, normed=1) #diff 输入的数组,bin的个数 # matplotlib version (plot)
pylab.show()
# Compute the histogram with numpy and then plot it
(n, bins) = numpy.histogram(diff, bins=100, normed=True) # NumPy version (no plot)
pylab.plot(.5*(bins[1:]+bins[:-1]), n)
pylab.show()
pylab 画直方图,numpy画直方图。
最新推荐文章于 2024-05-28 14:32:34 发布