Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- grades = [3, 8, 1, 4, 10, 9]
- week = list(range(1, len(grades) + 1))
- max_grade = max(grades)
- min_grade = min(grades)
- min_index = grades.index(min(grades))
- plt.plot(
- week[:min_index + 1], grades[:min_index + 1], '-.k',
- week[min_index:], grades[min_index:], ':k'
- )
- plt.plot(week[grades.index(max(grades))], max_grade, marker = "*")
- plt.plot(week[grades.index(min(grades))], min_grade, marker = "^")
- threshold = 7
- for x in grades:
- if threshold < x and x < max_grade:
- plt.plot(week[grades.index(x)], x, marker='o')
- elif min_grade < x and x < threshold:
- plt.plot(week[grades.index(x)], x, marker='s')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement