Skip to content

Commit 2584d47

Browse files
ruelasvhpre-commit-ci[bot]andrzejnovak
authored
feat: allow setting c-o-m in exp label (#433)
* Update label.py Remove hard-coded lumi for loc==4 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update label.py Correctly format com and lumi * fix: fix tests --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Andrzej Novak <[email protected]>
1 parent ec5e150 commit 2584d47

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/mplhep/label.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,19 @@ def exp_label(
403403
_com_label = r"\mathrm{13\ TeV}"
404404

405405
if lumi is not None:
406-
_lumi = (
407-
r"$\sqrt{s} = " + _com_label + ", " + str(lumi) + r"\ \mathrm{fb}^{-1}$"
406+
_lumi = r"{com}, {lumi}".format(
407+
com=r"$\sqrt{s} = \mathrm{" + str(com) + r"\ TeV}$"
408+
if com is not None
409+
else r"$\sqrt{s} = \mathrm{13\ TeV}$",
410+
lumi=lumi_format.format(lumi) + r" $\mathrm{fb^{-1}}$",
408411
)
409412
else:
410-
_lumi = r"$\sqrt{s} = " + _com_label + "$"
413+
_lumi = r"{com}".format(
414+
com=r"$\sqrt{s} = \mathrm{" + str(com) + r"\ TeV}$"
415+
if com is not None
416+
else r"$\sqrt{s} = \mathrm{13\ TeV}$",
417+
)
418+
411419
explumi = ExpSuffix(
412420
*exptext.get_position(),
413421
text=rlabel if rlabel is not None else _lumi,

tests/baseline/test_label_loc.png

-68 Bytes
Loading

tests/baseline/test_pub_loc.png

-68 Bytes
Loading

0 commit comments

Comments
 (0)