From a1fda33f9f2665102f913b34eb8cba0ddd2f785f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E7=BA=A2=E8=BE=89?= <2509165036@student.example.com> Date: Mon, 6 Jul 2026 14:18:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=204=5F3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 4_3 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 4_3 diff --git a/4_3 b/4_3 new file mode 100644 index 0000000..295b468 --- /dev/null +++ b/4_3 @@ -0,0 +1,17 @@ +import matplotlib.pyplot as plt +import json +rating=[] +with open('movie.json', 'r', encoding='utf-8') as f: + data=json.load(f) + # print(data) + for i in data: + rating.append(i["rating"]) +plt.figure(figsize=(12,8)) +plt.hist(rating, # 数据 + bins=3, # 分成几个柱子 + color='#3498DB', # 颜色 + edgecolor='white') # 柱子边框颜色 +plt.title('评分分布', fontsize=14) +plt.xlabel('评分', fontsize=13) +plt.grid(True, linestyle='--', alpha=0.5, axis='y') +plt.show() \ No newline at end of file