📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Python from Zero Matplotlib Charts

Matplotlib Charts

5 min read
Matplotlib creates charts: plt.plot() for lines, plt.bar() for bars, plt.scatter() for points. Add plt.xlabel(), plt.title(), and plt.legend(). Save with plt.savefig('chart.png') or show with plt.show().

Plotting with Matplotlib

pip install matplotlib

import matplotlib.pyplot as plt

x = [1, 2, 3, 4, 5]
y = [10, 24, 18, 35, 28]

plt.plot(x, y, marker="o", color="blue")
plt.title("Sales Trend")
plt.xlabel("Month")
plt.ylabel("Revenue ($K)")
plt.grid(True)
plt.savefig("chart.png")
plt.show()