From 058e8031136a88a229738e54a48a41efcbb7495e Mon Sep 17 00:00:00 2001 From: Victor Ruelas-Rivera Date: Thu, 13 Jul 2023 11:26:28 +0200 Subject: [PATCH] Update label.py Correctly format com and lumi --- src/mplhep/label.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/mplhep/label.py b/src/mplhep/label.py index 4077e0c4..73b1c248 100644 --- a/src/mplhep/label.py +++ b/src/mplhep/label.py @@ -347,15 +347,18 @@ def exp_label( fig=ax.figure, ) if lumi is not None: - _lumi = ( - r"$\sqrt{s} = \mathrm{" - + lumi_format.format(lumi) - + r"\ TeV}, " - + str(lumi) - + r"\ \mathrm{fb}^{-1}$" + _lumi = r"{com}, {lumi}".format( + com=r"$\sqrt{s} = \mathrm{" + str(com) + r"\ TeV}$" + if com is not None + else r"$\sqrt{s} = \mathrm{13\ TeV}$", + lumi=lumi_format.format(lumi) + r" $\mathrm{fb^{-1}}$", ) else: - _lumi = "" + _lumi = r"{com}".format( + com=r"$\sqrt{s} = \mathrm{" + str(com) + r"\ TeV}$" + if com is not None + else r"$\sqrt{s} = \mathrm{13\ TeV}$", + ) explumi = ExpSuffix( *exptext.get_position(), text=rlabel if rlabel is not None else _lumi,