Matplotlib
The fundamental Python plotting library for static charts of publication quality.
Basic information
| Name | Matplotlib |
|---|---|
| Full name | Matplotlib |
| Category | Scientific Computing & Data Processing Libraries |
| Developer | The Matplotlib community (sponsored by NumFOCUS) |
| Release year | 2003 |
| Official website | matplotlib.org |
| GitHub repository | matplotlib/matplotlib |
| Official documentation | matplotlib.org |
| Package on PyPI | matplotlib |
| License | Matplotlib License (based on the PSF license) (PyPI classifier) |
| Project status | Active Had a release in the last 12 months |
| Latest version | 11 September 2026 (version 3.11.2) |
| Programming language | Python |
| Operating systems | Not specified |
| Required Python version | >=3.11 |
| Difficulty level | Beginner |
Data last checked: 21 November 2026 — source: PyPI JSON API (2026-11-21)
Overview
Matplotlib gives full control over every element of a chart: axes, colours, lines and annotations, and exports charts as PNG, PDF and SVG, suitable for scientific papers.
It is used to plot training and loss curves, confusion matrices, and to display images and segmentation results. Seaborn builds a simpler interface for statistical charts on top of it.
When to choose it? Choose it for static, publication-quality charts with full control.
Uses
Main uses
- Plotting training and validation curves
- Displaying images and masks
- Figures for scientific papers
Scientific fields
- All fields of scientific research
- Data science
Suitable project types
- Experiment result reports
- Static analysis dashboards
Research applications
- Preparing figures for scientific papers
- Visualising and comparing experiment results
Technical features
A feature is shown as "Supported" only if it is documented in the library's official documentation; anything we have not verified is shown as "Not specified".
| CPU support | Supported |
|---|---|
| GPU support | Not applicable |
| CUDA compatibility | Not applicable |
| Distributed training or computing | Not applicable |
| Automatic differentiation (Autodiff) | Not applicable |
| Model deployment | Not applicable |
| Pre-trained models | Not applicable |
| Supported data types | NumPy arrays and pandas columns |
| Integration with other libraries | NumPy, Pandas, Seaborn |
| Flexibility (editorial estimate) | Very high |
| Performance (editorial estimate) | Suited to static charts |
| Community (editorial estimate) | Huge |
| Documentation quality (editorial estimate) | Large documentation and example gallery |
Installation and running
pip install matplotlibCompatibility: Python >=3.11 — according to the package data on PyPI, checked on 21 November 2026
Installing inside a virtual environment (venv or conda) is recommended. If you need compatibility with a specific CUDA version or operating system, refer to the official documentation, because this information changes with every release.
Code examples
Examples marked "Run and tested" were actually run, with their output, test date and library versions recorded; the others need a GPU or model downloads, so they were not run in the test environment.
BeginnerPlotting and saving the training and validation curveRun and tested
Goal: Producing a publication-quality figure of the two loss curves.
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
epochs = range(1, 11)
train = [0.9, 0.7, 0.55, 0.46, 0.40, 0.36, 0.33, 0.31, 0.30, 0.29]
val = [0.95, 0.76, 0.62, 0.55, 0.51, 0.50, 0.50, 0.51, 0.53, 0.55]
fig, ax = plt.subplots(figsize=(6, 3.5))
ax.plot(epochs, train, marker="o", label="train")
ax.plot(epochs, val, marker="s", label="validation")
ax.set_xlabel("epoch"); ax.set_ylabel("loss"); ax.legend(); ax.grid(alpha=.3)
fig.tight_layout()
fig.savefig("loss.png", dpi=200)
best = min(range(len(val)), key=val.__getitem__) + 1
print("Figure saved to loss.png; best epoch on validation:", best)
Code explanation
We use the Agg backend because it needs no display, plot two curves with a legend, then save the figure as PNG at 200 dots per inch. You can save as PDF or SVG for scientific papers.
Output recorded during testing
Figure saved to loss.png; best epoch on validation: 6
This example was actually run and tested on 21 November 2026 on a CPU — matplotlib 3.11.2, python 3.13.18
Pros
- Fine control over every detail of a chart
- Publication-ready quality
- Supports vector formats
Limitations
- The API is verbose for complex charts
- Limited interactivity compared with Plotly
References and verification
- Package page on PyPI (source of the version, licence and release date) Checked directly
https://pypi.org/project/matplotlib/
Checked on: 21 November 2026 — version checked: 3.11.2 — reviewed by: the DLArabic team
- Official website A link the package officially declares on PyPI
https://matplotlib.org
Checked on: 21 November 2026 — reviewed by: the DLArabic team
- Official documentation A link the package officially declares on PyPI
https://matplotlib.org
Checked on: 21 November 2026 — reviewed by: the DLArabic team
- Official repository A link the package officially declares on PyPI
https://github.com/matplotlib/matplotlib
Checked on: 21 November 2026 — reviewed by: the DLArabic team
History of verified versions
| Version | Release date | Checked on |
|---|---|---|
| 3.11.2 | 11 September 2026 | 21 November 2026 |
Page information last reviewed: 21 November 2026. The description was written originally for the encyclopedia and is not copied from the official websites.
