import matplotlib.pyplot as plt
x=[1,1,1,2,3,4,5,6,7,5,5,5,6,2,4,2,7,8,9,10]
#bins相当于绘制直方图时,x轴上的区间大小
bins=[0,1,2,3,4,5,6,7,8,9,10]
plt.hist(x,bins,histtype='bar',rwidth=0.8,color='red')
plt.xlabel('X')
plt.ylabel('num')
plt.title('The X hist')
plt.show()
直方图绘制(python实现)
最新推荐文章于 2024-01-27 20:50:07 发布