mplhep-data
mplhep-data is a font (data) sub-package for `mplhep`, providing several common High Energy Physics fonts like Tex Gyre Termes and Latin Modern. It is currently at version 0.0.5 and appears to have an infrequent release cadence focused on adding new fonts or maintenance. It acts as a data provider, making these fonts available for `mplhep` styles rather than offering a direct Python API for users.
Warnings
- gotcha mplhep-data is a soft dependency of `mplhep`. If `mplhep` styles (e.g., ATLAS, CMS, LHCb) appear to render incorrectly or display default fonts, it is likely that `mplhep-data` has not been installed, preventing `mplhep` from accessing the intended fonts.
- gotcha As a data package, `mplhep-data` itself doesn't offer a Python API for direct user interaction. Attempts to `import mplhep_data` for programmatic use of fonts directly will likely be unfruitful, as its purpose is to make resources available to `mplhep`'s styling system.
- gotcha Due to the low major version (0.x.x), minor version updates could potentially introduce new fonts or subtly modify existing ones. While typically stable for a data package, this might lead to minor visual changes in plots if specific font characteristics are strictly relied upon.
Install
-
pip install mplhep-data
Imports
- N/A
mplhep-data provides data assets for mplhep; direct Python imports are not typically used by end-users.
Quickstart
import matplotlib.pyplot as plt
import mplhep as hep
# mplhep-data is implicitly used by mplhep for its font assets.
# Ensure mplhep-data is installed for full font support in mplhep styles.
plt.style.use(hep.style.ATLAS) # Or hep.style.CMS, hep.style.LHCb, etc.
fig, ax = plt.subplots()
ax.plot([0, 1], [0, 1])
ax.set_xlabel("x-axis")
ax.set_ylabel("y-axis")
ax.set_title("Example Plot with mplhep Style")
hep.atlas.label("Preliminary") # Example using a label from mplhep
plt.show()