forked from 2509165022/simulated-examination
15 lines
346 B
Python
15 lines
346 B
Python
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.hist(ratings, bins=5,color='blue')
|
|
plt.savefig('q4_3a_hist.png',dpi=150)
|