Untitled
Anonymous
Plain Text
10/12/2025 1:50 PM
606 B
14
Indexable
Never
import matplotlib.pyplot as plt
# Data
students = ["Anna", "Ben", "Rudo", "Sue", "Tim", "Lori", "Lulu", "Jim", "Kim", "Farai"]
maths = [70, 62, 49, 78, 45, 38, 68, 82, 57, 72]
physics = [50, 60, 73, 67, 70, 54, 59, 80, 82, 85]
# Plot
plt.figure(figsize=(7, 5))
plt.scatter(maths, physics, color='blue', edgecolor='black')
for i, name in enumerate(students):
plt.text(maths[i] + 0.5, physics[i] + 0.5, name, fontsize=9)
plt.title("Scatter Diagram of Maths vs Physics Marks")
plt.xlabel("Maths Marks")
plt.ylabel("Physics Marks")
plt.grid(True, linestyle='--', alpha=0.6)
plt.show()
Editor is loading...
Leave a Comment