删除 2.py
This commit is contained in:
17
2.py
17
2.py
@@ -1,17 +0,0 @@
|
|||||||
import json
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
|
|
||||||
movies = json.load(open('movies.json', encoding='utf-8'))['movies']
|
|
||||||
# print(movies)
|
|
||||||
ratings = []
|
|
||||||
durations = []
|
|
||||||
for m in movies:
|
|
||||||
ratings.append(m['rating'])
|
|
||||||
durations.append(m['duration'])
|
|
||||||
|
|
||||||
plt.figure(figsize=(8,5))
|
|
||||||
plt.scatter(durations,ratings,color='red',alpha=0.6)
|
|
||||||
plt.title('时长与评分关系散点图')
|
|
||||||
plt.xlabel('duration')
|
|
||||||
plt.ylabel('rating')
|
|
||||||
plt.savefig('q4_2_scatter.png', dpi=150)
|
|
||||||
Reference in New Issue
Block a user