Last updated
Scatter Plot
Definition: A scatter plot draws one dot per data point, using two values as its X and Y position. It is the best way to see a relationship between two variables.
Example — does car age affect speed?
We use Matplotlib, the standard plotting library. Press Run and a real chart appears below:
import matplotlib.pyplot as plt
car_age = [5, 7, 8, 7, 2, 17, 2, 9, 4, 11]
speed = [99, 86, 87, 88, 100, 86, 103, 87, 94, 78]
plt.scatter(car_age, speed)
plt.title("Car age vs Speed")
plt.xlabel("Age of car (years)")
plt.ylabel("Speed (km/h)")
Reading the plot
Look at the cloud of dots. Here, as car age increases, speed tends to drop — a negative relationship. Spotting these trends by eye is the first step before fitting a model.
💡 Note: you do not need plt.show() here — the chart is captured and displayed automatically.
Try it Yourself
Output
Ad · responsive