This commit is contained in:
2509165028
2026-06-23 11:24:33 +08:00
parent e0298a4a32
commit 09b797a780
8 changed files with 74 additions and 0 deletions

16
q4/q4_3a/q4_3a.py Normal file
View File

@@ -0,0 +1,16 @@
import json
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
with open('simulated-examination/q2_1_crawler/movies.json', 'r', encoding='utf-8') as f:
movies = json.load(f)
ratings = [m['rating'] for m in movies]
plt.figure()
plt.hist(ratings, bins=5, color='blue')
plt.title("评分分布")
plt.xlabel("评分")
plt.savefig('q4_3a_hist.png', dpi=150)

BIN
q4/q4_3a/q4_3a_hist.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB