Python3使用matplotlib绘制直方图(2)

# 时间段
interval = [0,5,10,15,20,25,30,35,40,45,60,90]
# 组距
width = [5,5,5,5,5,5,5,5,5,15,30,60]
#
quantity = [836,2737,3723,3926,3596,1438,3273,642,824,613,215,47]
# 设置图形大小
plt.figure(figsize=(20,8),dpi=80)
plt.bar(range(len(quantity)),quantity,width=1)
# 设置x轴数字
_x = [i-0.5 for i in range(13)]
_xtick_lacel = interval+[150]
plt.xticks(_x,_xtick_lacel)
plt.grid(alpha=0.4)
plt.savefig("./06.png")
plt.show()

效果图

Python3使用matplotlib绘制直方图

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/dd6508588d063171021f1faed66ca3d3.html