Python数据分析与展示笔记

第二周plt

plt.hist问题

import numpy as np
import matplotlib.pyplot as plt

np.random.seed(0)
mu ,sigma =100,20#均值和标准差
a=np.random.normal(mu,sigma,size = 100)
plt.hist(a,20,density=True,histtype= 'stepfilled',facecolor = 'b',alpha = 0.75)#normed=1已经失效,改为density=True
plt.title('Histogram')

plt.show()

你可能感兴趣的:(笔记,经验分享)