원클릭으로
hep-plot
Publication-quality HEP plots with matplotlib and mplhep — distributions, stacked histograms, ratio panels, multi-panel figures
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Publication-quality HEP plots with matplotlib and mplhep — distributions, stacked histograms, ratio panels, multi-panel figures
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Numerically evaluate a FormCalc-reduced one-loop amplitude with LoopTools 2.16 (Passarino-Veltman integrals via the Wolfram/LoopTools MathLink) and emit a scattering/v1 JSON (σ_SI, σ_SD) for direct detection. Unblocks the 2HDM+a loop-only DD path. Self-heals via _shared/installs/looptools preflight.
Reduce a FeynArts amplitude list with FormCalc 9.10. Produces amp_reduced.m and amp_reduced.meta.json sidecar conforming to amp_reduced.meta/v1. Self-heals via _shared/installs/formcalc preflight.
Generate Feynman diagrams and amplitudes using FeynArts 3.11. Supports built-in models (SM, SMQCD, THDM, MSSM) and SARAH-generated models. Outputs FeynAmpList.m, diagrams.pdf, topologies.json, and metadata sidecar.
Compute direct-detection likelihoods and 90%-CL exclusion verdicts using DDCalc 2.2.0. Leaf consumer of scattering/v1 JSON from /micromegas or /formcalc.
MadDM — dark matter relic density, direct detection cross-sections, indirect detection rates, parameter scans with experimental limit comparison
Run HiggsBounds-5 + HiggsSignals-2 constraint checks on a model SLHA file. Computes hb_allowed (per-channel AND), hs_consistent (Δχ² < 6.18), p-values, and per-channel CSV. Supports single-point and scan-directory modes.
| name | hep-plot |
| description | Publication-quality HEP plots with matplotlib and mplhep — distributions, stacked histograms, ratio panels, multi-panel figures |
Generate publication-quality plots for HEP phenomenology papers using matplotlib with the mplhep style library. Covers the most common plot types in phenomenology publications.
Determine the plot type:
Set the experiment style:
import mplhep as hep
hep.style.use("ATLAS") # or "CMS", "LHCb", "ALICE", "ATLAS"
If no experiment context, use "CMS" as the default (clean and widely recognized). For theory-only papers with no experimental affiliation, use a clean custom style.
Build the figure:
Axis labels: Always include units. Use LaTeX rendering.
ax.set_xlabel(r"$m_{t\bar{t}}$ [GeV]")
ax.set_ylabel(r"$d\sigma/dm_{t\bar{t}}$ [pb/GeV]")
Legends: Place inside the plot area where there is empty space. Use short, descriptive labels. Order: data first, then signal, then backgrounds largest-to-smallest.
Colors: Use a colorblind-friendly palette. Default ordering:
Log scale: Use log y-axis when the distribution spans more than 2 orders of magnitude. Always use linear x-axis unless the variable is intrinsically logarithmic (e.g., Q^2).
Ratio panel (include whenever data and theory/MC are both present):
from styles.hep_ph_style import make_ratio_panel
fig, (ax, rax) = make_ratio_panel()
Uncertainty bands:
ax.fill_between() for continuous bandsOutput:
fig.savefig("plot.pdf", bbox_inches="tight")Input: "Plot the transverse momentum distribution of the leading jet for signal (Z' -> tt, m_Z' = 3 TeV) and backgrounds (ttbar, W+jets) as a stacked histogram with a data/MC ratio panel, CMS style, sqrt(s) = 13 TeV, 139 fb^-1"
Output: Complete Python script producing a two-panel figure with stacked backgrounds, signal overlay, mock data points with error bars, CMS preliminary label, luminosity text, and a ratio panel with uncertainty band.
Reference:
docs/design-system.md— the canonical source of truth for all visual rules.
Palette: Cool Analytic (styles/hephaestus-analytic.mplstyle). Load with:
from styles.hep_ph_style import set_hep_context
palette = set_hep_context("analytic")
Key rules:
#0284c7 (blue), 1.0pt solid. Data: #1a1a1a (black), points + 0.7pt error bars. Black data points have maximum contrast against any background.apply_direct_labels() — endpoint labels on each curve, right-aligned.text.usetex: True. Axis labels 9pt italic, tick labels 8pt roman, annotations 8pt, subsidiary text 7pt gray.Helper functions (styles/hep_ph_style.py):
escalate_colors(n_models, n_variants) — returns colors + line styles per escalation ladderapply_direct_labels(ax) — endpoint labels with collision avoidanceadd_uncertainty_band(ax, x, y, yerr_up) — correct alpha + boundary stylingmake_ratio_panel() — main + ratio panel with 0.3 height ratio, shared x-axischeck_overlaps(fig) — detect overlapping text; run before savefig() and fix any issues it reportsMandatory overlap check — do not skip this step:
from styles.hep_ph_style import check_overlaps
issues = check_overlaps(fig)
if issues:
print(f"WARNING: {len(issues)} text overlaps detected:")
for iss in issues:
print(f" '{iss['text_a']}' vs '{iss['text_b']}' — {iss['overlap_pt']}pt")
If check_overlaps returns any issues, you must fix them before saving. Common fixes: reposition labels, reduce font size, abbreviate text, increase figure size, or switch from direct labels to a legend. Re-run the check after fixing until it returns an empty list.