{"library":"mplhep","title":"Matplotlib styles for HEP","description":"mplhep is a Python library providing Matplotlib styles and utility functions tailored for High Energy Physics (HEP) plotting. It simplifies the creation of plots compatible with various LHC experiments (ATLAS, CMS, LHCb, ALICE) and offers tools for 1D and 2D histograms, including comparison plots. The library is actively maintained, with the current version being 1.1.2, and sees regular patch and minor releases.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install mplhep"],"cli":null},"imports":["import mplhep as hep","import matplotlib.pyplot as plt","hep.style.use(\"CMS\")","hep.histplot(...)"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import matplotlib.pyplot as plt\nimport mplhep as hep\nimport numpy as np\n\n# Set the CMS experiment style\nhep.style.use(\"CMS\")\n\n# Generate some dummy data for a histogram\ndata = np.random.normal(loc=5, scale=2, size=1000)\nbins = np.linspace(0, 10, 20)\nhist, edges = np.histogram(data, bins=bins)\n\n# Create a figure and axes\nfig, ax = plt.subplots()\n\n# Plot the histogram using mplhep's histplot\nhep.histplot(hist, edges, ax=ax, label=\"My Data\")\n\n# Add experiment label (e.g., CMS)\nhep.cms.label(loc=0, data=True, lumi=20, year=2018, ax=ax)\n\n# Add a legend and show the plot\nax.legend()\nax.set_xlabel(\"X-axis [GeV]\")\nax.set_ylabel(\"Entries\")\nplt.tight_layout()\nplt.show()","lang":"python","description":"This quickstart demonstrates how to import `mplhep`, apply an experiment-specific style (CMS in this case), plot a 1D histogram using `hep.histplot`, and add an experiment label with luminosity and year information. It uses `numpy` for data generation and `matplotlib.pyplot` for basic plot setup and display.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"1.1.3","pypi_latest":"1.2.0","is_stale":true,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":7.7,"avg_import_s":2.67,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"mplhep","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":2.44,"mem_mb":30.8,"disk_size":"196.6M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"mplhep","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":7.8,"import_time_s":1.87,"mem_mb":30.8,"disk_size":"189M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"mplhep","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":3.64,"mem_mb":33.8,"disk_size":"212.1M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"mplhep","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":7.3,"import_time_s":3.27,"mem_mb":33.8,"disk_size":"203M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"mplhep","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":2.9,"mem_mb":33,"disk_size":"198.9M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"mplhep","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":7.1,"import_time_s":3.17,"mem_mb":33,"disk_size":"189M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"mplhep","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":2.6,"mem_mb":33.3,"disk_size":"198.2M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"mplhep","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":7.2,"import_time_s":2.78,"mem_mb":33.3,"disk_size":"189M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"mplhep","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":2.08,"mem_mb":30.1,"disk_size":"200.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"mplhep","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":9.1,"import_time_s":1.91,"mem_mb":30.1,"disk_size":"195M"}]}}