Python Numpy matplotlib Histograms 直方图

import numpy as np
import matplotlib.pyplot as plt 
mu,sigma = 2,0.5
v = np.random.normal(mu,sigma,10000)
plt.hist(v,bins=50,density=1)
plt.show()

Python Numpy matplotlib Histograms 直方图_第1张图片

import numpy as np
import matplotlib.pyplot as plt 
mu,sigma = 2,0.5
v = np.random.normal(mu,sigma,10000)
(n,bins) = np.histogram(v,bins=50,density=True)
plt.plot(.5*(bins[1:]+bins[:-1]),n)
plt.show()

Python Numpy matplotlib Histograms 直方图_第2张图片

你可能感兴趣的:(matplotlib,numpy)