根据统计数据画直方图

from matplotlib import pyplot as plt

interval = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 60, 90] # 时间
width = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 15, 30, 60] # 时间间隔
quality = [836, 2737, 3723, 3926, 2596, 1438, 3273, 642, 824, 613, 215, 47] # 人数

plt.figure(figsize=(20, 8), dpi=80)
plt.bar(range(len(quality)), quality, width=1)
x = [i-0.5 for i in range(13)]
xticks_labels = interval+[150]
plt.xticks(x, xticks_labels)
plt.show()
posted @ 2020-03-20 14:25  Bambo0  阅读(440)  评论(0编辑  收藏  举报