From 6a4170c1fede0e8a2f20883d335624d5fdce629a Mon Sep 17 00:00:00 2001 From: fly6516 Date: Mon, 14 Apr 2025 04:01:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor(2-9):=E5=B0=86=E6=9D=A1=E5=BD=A2?= =?UTF-8?q?=E5=9B=BE=E6=94=B9=E4=B8=BA=E6=8A=98=E7=BA=BF=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 matplotlib 绘制条形图的代码修改为绘制折线图 - 使用 plot函数替代 bar 函数,添加 marker、linestyle 等参数以美化图表 --- 2-9.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2-9.py b/2-9.py index e3c5a88..298af4b 100644 --- a/2-9.py +++ b/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响应次数')