From dcafc459f21e07523aaf3dadfb7bbd5ade9a06ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=A5=A0=E6=A5=A0?= <2509165032@student.example.com> Date: Tue, 23 Jun 2026 11:13:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20q4/q4=5F2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- q4/q4_2/q4_2.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 q4/q4_2/q4_2.py diff --git a/q4/q4_2/q4_2.py b/q4/q4_2/q4_2.py new file mode 100644 index 0000000..18bf9fe --- /dev/null +++ b/q4/q4_2/q4_2.py @@ -0,0 +1,14 @@ +import json +import matplotlib.pyplot as plt + +with open("../q2_1_crawler/movies.json","r",encoding="utf-8") as f: + data = json.load(f) +movies = data["movies"] + +rating = [i["rating"] for i in movies] +duration = [i["duration"] for i in movies] + +plt.scatter(duration,rating) +plt.tight_layout() +plt.savefig("q4_2_scatter.png",dpi=150) +plt.close() \ No newline at end of file