← Data Visualization learning pathData Visualization · Module 5 of 10
Matplotlib basics
Draw charts in Python with Matplotlib.
📖 Key ideas
- import matplotlib.pyplot as plt.
- plt.plot(x, y) for lines; plt.bar(x, h) for bars; plt.scatter for points.
- plt.title, plt.xlabel, plt.ylabel add labels.
- fig, ax = plt.subplots() gives more control.
- plt.savefig("chart.png", dpi=150) saves the chart.
💡 Real-life example: Matplotlib is a drawing board where you place each line and label yourself.
pyplotMatplotlib's plotting interface
FigureThe whole image
AxesA single plot area
savefigSaves the chart to a file