mplhep
Matplotlib styles for HEP
What it is and what it does
mplhep is a matplotlib extension that bundles styling presets and helper functions for producing plots that conform to High Energy Physics collaboration standards. It provides ready-made styles for CMS, ATLAS, LHCb, and ALICE experiments, allowing physicists to generate ROOT-like plots without manually configuring fonts, colors, and layout conventions. The package wraps matplotlib's styling system and adds domain-specific utilities, reducing boilerplate when preparing figures for HEP publications.
The package depends on matplotlib as its core plotting backend, numpy for numerical operations, and uhi (Universal Histogram Indexing) for histogram-specific functionality. It is actively maintained by the Scikit-HEP collaboration and has been used in multiple published HEP analyses. Installation is straightforward and adds minimal overhead—it is a pure Python wheel with no compiled dependencies.
Use it for:
- Apply CMS, ATLAS, LHCb, or ALICE collaboration plot styles to matplotlib figures for consistency with experiment standards.
- Generate publication-ready physics plots with correct fonts and layout conventions without manual style configuration.
- Produce ROOT-compatible plot aesthetics in Python workflows when ROOT itself is not available or practical.
- Standardize plot appearance across a collaboration or analysis team by importing a shared style preset.
- Combine HEP-specific styling with custom matplotlib code for specialized physics visualizations.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
mplhep provides matplotlib styling and helper functions to produce publication-ready plots following High Energy Physics collaboration standards (ROOT-like appearance for CMS, ATLAS, LHCb, ALICE).
Yes. mplhep is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and solves a real problem for HEP researchers: conforming plots to collaboration standards with minimal effort. Low install friction and modest but stable community adoption make it a safe choice for physics plotting workflows. Install it if you are producing plots for HEP experiments or collaborations.
Install
mplhep on PyPI
pip
pip install mplhepuv
uv add mplheppoetry
poetry add mplhepInstalling mplhep
Before you install
Low friction: pure Python wheel with four runtime dependencies (matplotlib, numpy, uhi, mplhep-data). Active maintenance with a release 22 days ago and recent commits; 221 repository stars indicate modest but steady community engagement.
License in practice
MIT license is permissive; you can use, modify, and distribute mplhep freely in commercial or private projects with minimal restrictions.
Quickstart
pip install mplhep
import mplhep as hep
import matplotlib.pyplot as plt
plt.style.use(hep.style.CMS)
# Create plots with CMS-compatible styling
Requires Python 3.11 or later; matplotlib and numpy must be installed.
Verify before relying
- Whether mplhep-data package is automatically installed as a dependency or must be installed separately.
- Specific font availability (Fira Sans, Tex Gyre Heros) and whether they are bundled or require system installation.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — matplotlib, mplhep-data, numpy, uhi |
| Maintenance | actively maintained — 22 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 368,011/month — #7,192 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mplhep-1.3.2-py3-none-any.whl
Tags
More Physics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
pydicomPydicom reads, modifies, and writes DICOM…
permissive · top 5,000 on PyPI
albumentationsAlbumentations applies image transformations to…
permissive · top 5,000 on PyPI
CoolPropCoolProp provides thermodynamic and transport…
permissive · top 5,000 on PyPI
pyquaternionProvides quaternion representation,…
permissive · top 5,000 on PyPI
mplhep-dataDistributes fonts and data files for the mplhep…
permissive · top 15,000 on PyPI
lovelyplotsLovelyPlots provides matplotlib style sheets…
permissive · top 15,000 on PyPI
particleProvides a pythonic interface to Particle Data…
permissive · top 15,000 on PyPI
coffeacoffea provides columnar data analysis tools…
permissive · top 15,000 on PyPI
SciencePlotsProvides a collection of Matplotlib style…
permissive · top 15,000 on PyPI
mplfontsManages Matplotlib fonts and solves CJK…
permissive · top 15,000 on PyPI
hepunitsProvides units and physical constants in the…
permissive · top 15,000 on PyPI
koreanize-matplotlibAutomatically configures matplotlib to display…
permissive · top 15,000 on PyPI
uprootUproot reads and writes ROOT files (the data…
permissive · top 5,000 on PyPI
mpld3Converts matplotlib plots to interactive D3.js…
permissive · top 15,000 on PyPI