import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from scipy.stats import norm
# 产生数据
mu =100# mean of distribution
sigma =15# standard deviation of distribution
x = mu + sigma * np.random.randn(10000)
num_bins =50# 区间个数
n, bins
统计区间内的样本数画直方图一、使用plt.histimport numpy as npimport matplotlib.mlab as mlabimport matplotlib.pyplot as pltfrom scipy.stats import norm# 产生数据mu = 100 # mean of distributionsigma = 15 # standard deviation of distributionx = mu + sigma * np.random.r