Data Visualization

matplotlib

The original Python chart-maker that even the shinier tools still quietly lean on underneath.

Install it: pip install matplotlib

What does it do?

Matplotlib turns numbers into charts, line graphs, bar charts, scatter plots, giving fine, almost obsessive control over every visual detail, down to the exact tick marks on an axis. It was modeled after MATLAB’s plotting style, which is why the two names look alike, and it became the foundational plotting tool most of Python’s data science world was built on top of. It’s not the flashiest option today, and its default charts can look a bit dated, but its sheer flexibility and decades of history mean it’s everywhere. Nearly every other Python plotting library either builds on it or was created specifically to fix its rough edges.

See it in action

This code draws a simple line chart from a list of numbers, labels the axes, and saves the picture to a file.

import matplotlib.pyplot as plt

x = [1, 2, 3, 4]
y = [10, 20, 25, 30]

plt.plot(x, y)
plt.xlabel("Day")
plt.ylabel("Sales")
plt.savefig("chart.png")

Why would a non-developer care?

Practically every static chart you’ve seen in a scientific paper, a data journalism piece, or a company report made with Python passed through Matplotlib at some point, whether directly or through a tool built on top of it. Reliable, customizable charts are how raw numbers become understandable stories, and this is the tool that made that possible in Python from the very beginning.

Real-world examples

It’s a foundational tool in scientific research, and NASA has used it to visualize mission data, including plots tied to the Curiosity rover. It’s also the plotting engine underneath pandas’ popular quick-plot charts, meaning huge numbers of people use Matplotlib without ever realizing it by name.

Who uses it

Researchers, data analysts, and scientists needing precise, publication-quality static charts, plus anyone using higher-level tools like pandas or Seaborn built on top of it.

How it compares to alternatives

Seaborn builds directly on Matplotlib to make statistical charts prettier with less code, while Plotly and Bokeh trade some of Matplotlib’s fine-grained control for built-in browser interactivity. For static, publication-ready figures, Matplotlib remains the standard despite newer, shinier alternatives.

Fun fact

Matplotlib was created by neurobiologist John D. Hunter in the early 2000s partly to help visualize brain electrode data, after growing frustrated with the cost and limitations of MATLAB’s plotting tools at the time.

New to Python and want to actually try libraries like this yourself?

Find a beginner-friendly course

Related libraries