Lesson 12: Scatter Plots, Histograms & Bar Charts

1. Scatter Plots – Relationships

Show relationship between two numeric variables.

plt.scatter(df["sepal_length"], df["petal_length"], c=df["species"])
plt.xlabel("Sepal Length")
plt.ylabel("Petal Length")
plt.title("Iris Flowers")
plt.show()

Used in ML: visualize feature pairs, clusters.

Exercise 1

What does scatter plot help discover?

2. Histograms – Distribution

Show frequency distribution of one numeric variable.

plt.hist(df["age"], bins=10, color="skyblue", edgecolor="black")
plt.xlabel("Age")
plt.ylabel("Frequency")
plt.title("Age Distribution")
plt.show()

Used in ML: check feature distributions, spot skewness.

Exercise 2

To create histogram with 15 bins:
plt.hist(data, =15, color="green")

Exercise 3

Which plots are good for what?
← Previous Lesson (11) Next Lesson (13) →