Matplotlib & Seaborn
Part of the Python Roadmap
In short
A table of 50 numbers hides the story. One plot shows the trend, the outlier and the gap in seconds, for you first and for your audience later.
Matplotlib is Python's core plotting library and Seaborn builds on it with nicer defaults and statistical charts. Together they create line, bar, scatter, histogram and box plots from your data.

Think of it like this
Rangoli by hand or with a stencil
You can draw a rangoli dot by dot, controlling every line. Or you lay a stencil and get a beautiful pattern quickly, then touch it up by hand. Matplotlib is the by-hand control. Seaborn is the stencil built on top of it.
Watch it happen
Which one do I reach for?
Matplotlib
- Full control over every element
- More code for nice looks
- Base layer for most Python plots
Seaborn
- Good-looking statistical charts fast
- Works directly with DataFrame columns
- Built on Matplotlib, so tweakable
Start with Seaborn for exploring, then use Matplotlib calls to fix titles, labels and limits before sharing.
The big ideas
What you need to know
Figure and axes
A figure is the canvas; an axes is one chart on it. fig, ax = plt.subplots() gives you both.
Match chart to question
Trend over time: line. Compare groups: bar. Distribution: histogram or box. Relationship: scatter.
hue= adds a category
In Seaborn, hue="city" colours points or bars by city without any loops.
Label everything
Title, axis labels with units, readable ticks. An unlabeled chart forces people to guess.
See it in code
Walk through the code
1import matplotlib.pyplot as plt2import seaborn as sns3 4fig, ax = plt.subplots(figsize=(8, 4))5sns.barplot(data=summary, x="month", y="revenue", hue="city", ax=ax)6 7ax.set_title("Monthly revenue by city")8ax.set_xlabel("Month")9ax.set_ylabel("Revenue (₹)")10plt.tight_layout()11fig.savefig("revenue.png", dpi=150)1/4Create the canvas and one chart area, 8 by 4 inches.
Seaborn draws the chart in one line, Matplotlib polishes it, and savefig exports it for slides.
Save yourself the pain
Common mistakes
Oops
A pie chart with twelve thin slices.
Do this instead
Use a sorted bar chart. People compare bar lengths far better than slice angles.
Oops
Default charts pasted into a report with no title or units.
Do this instead
Add a title that states the finding and axis labels with units like ₹ or %.
Your mission
Four charts, four questions
Quick check
You want to see how delivery times are spread out, including any long tail. Best first chart?
Go deeper
- 1Plot monthly sales as a line chart with labelled axes and a title.
- 2Use Seaborn to draw a histogram and a box plot of one column.
- 3Save a chart to a PNG file with plt.savefig.
Also part of these roadmaps
More data & ai at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.