refactor(2-9):将条形图改为折线图
- 将 matplotlib 绘制条形图的代码修改为绘制折线图 - 使用 plot函数替代 bar 函数,添加 marker、linestyle 等参数以美化图表
This commit is contained in:
parent
11c1e21778
commit
6a4170c1fe
4
2-9.py
4
2-9.py
@ -60,9 +60,9 @@ if __name__ == "__main__":
|
||||
hours = [hour for hour, count in hourly_404_counts_list]
|
||||
counts = [count for hour, count in hourly_404_counts_list]
|
||||
|
||||
# 使用 matplotlib 绘制条形图
|
||||
# 使用 matplotlib 绘制折线图
|
||||
plt.figure(figsize=(10, 6))
|
||||
plt.bar(hours, counts, color='blue')
|
||||
plt.plot(hours, counts, marker='o', color='b', linestyle='-', linewidth=2, markersize=6)
|
||||
plt.title('每小时404响应代码数量')
|
||||
plt.xlabel('小时')
|
||||
plt.ylabel('404响应次数')
|
||||
|
Loading…
Reference in New Issue
Block a user