Table of Contents
ToggleRaw numbers can be hard to interpret. That’s where **data visualization** helps! In this lesson, you’ll learn how to use Python’s Matplotlib library to create line graphs, bar charts, histograms, and more.
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [10, 20, 25, 30, 40]
plt.plot(x, y)
plt.title("Simple Line Chart")
plt.xlabel("X Axis")
plt.ylabel("Y Axis")
plt.show()
Line charts help show trends over time.
categories = ['A', 'B', 'C']
values = [10, 15, 7]
plt.bar(categories, values)
plt.title("Category Distribution")
plt.show()
Use bar charts to compare categories.
import numpy as np
data = np.random.randn(1000)
plt.hist(data, bins=20)
plt.title("Histogram of Random Data")
plt.show()
Histograms are useful for showing data distribution.
plt.savefig() to save your charts⏭️ Coming Up: Learn how to make beautiful charts with Seaborn!
