diff --git a/docs/source/gallery/styles.rst b/docs/source/gallery/styles.rst index ea9dc66b..1b36222e 100644 --- a/docs/source/gallery/styles.rst +++ b/docs/source/gallery/styles.rst @@ -107,6 +107,20 @@ LHCb2 style .. image:: ../_static/_generated/LHCb2/band/pos0.png :width: 45% +LHCb3 style (new, long-term) + +.. image:: ../../_static/_generated/LHCb3/fill/pos0.png + :width: 45% + +.. image:: ../../_static/_generated/LHCb3/step/pos0.png + :width: 45% + +.. image:: ../../_static/_generated/LHCb3/errorbar/pos0.png + :width: 45% + +.. image:: ../../_static/_generated/LHCb3/band/pos0.png + :width: 45% + ALICE ------------ diff --git a/src/mplhep/styles/__init__.py b/src/mplhep/styles/__init__.py index b13bfb55..a8645f10 100644 --- a/src/mplhep/styles/__init__.py +++ b/src/mplhep/styles/__init__.py @@ -17,7 +17,7 @@ from .atlas import ATLAS, ATLAS1, ATLAS2, ATLASAlt, ATLASTex from .cms import CMS, ROOT, CMSTex, ROOTTex from .dune import DUNE, DUNE1, DUNETex, DUNETex1 -from .lhcb import LHCb, LHCb1, LHCb2, LHCbTex, LHCbTex1, LHCbTex2 +from .lhcb import LHCb, LHCb1, LHCb2, LHCb3, LHCbTex, LHCbTex1, LHCbTex2, LHCbTex3 from .plothist import plothist __all__ = ( @@ -38,9 +38,11 @@ "LHCb", "LHCb1", "LHCb2", + "LHCb3", "LHCbTex", "LHCbTex1", "LHCbTex2", + "LHCbTex3", "ROOTTex", "fabiola", "fira", diff --git a/src/mplhep/styles/lhcb.py b/src/mplhep/styles/lhcb.py index 8df60f1c..805c541e 100644 --- a/src/mplhep/styles/lhcb.py +++ b/src/mplhep/styles/lhcb.py @@ -238,6 +238,119 @@ "pgf.rcfonts": False, } +colors3 = [ + "#0078FF", + "#FF6600", + "#0AAFB6", + "#FF3333", + "#0000FF", + "#00CC00", + "#BF8040", + "#FF33CC", + "#FF7733", + "#BFD1D4", +] + +LHCb3 = { + # Plot properties + "axes.labelsize": 32, + "axes.linewidth": 2, + "axes.facecolor": "white", + "axes.xmargin": 0.0, + "axes.ymargin": 0.0, + # Custom colors + "axes.prop_cycle": cycler("color", colors2), + "axes.formatter.min_exponent": 3, + "axes.titlesize": 28, + # Errorbar properties + "errorbar.capsize": 2.5, + # Figure properties + "figure.figsize": (12, 9), + "figure.dpi": 100, + # Outer frame color + "figure.facecolor": "white", + "figure.autolayout": True, + # Set default font to Times New Roman + "font.family": "serif", + "font.serif": ["Tex Gyre Termes"], + "font.cursive": ["Tex Gyre Termes"], + "mathtext.fontset": "custom", + "mathtext.rm": "Tex Gyre Termes", + "mathtext.bf": "Tex Gyre Termes:bold", + "mathtext.sf": "Tex Gyre Termes", + "mathtext.it": "Tex Gyre Termes:italic", + "mathtext.tt": "Tex Gyre Termes", + "mathtext.cal": "Tex Gyre Termes", + "font.size": 14, + "font.weight": 400, + # Draw the legend on a solid background + "legend.frameon": False, + "legend.fancybox": True, + # Inherit the background color from the plot + "legend.facecolor": "inherit", + "legend.numpoints": 1, + "legend.labelspacing": 0.2, + "legend.fontsize": 28, + "legend.title_fontsize": 28, + # Automatically choose the best location + "legend.loc": "best", + # Space between the handles and their labels + "legend.handletextpad": 0.75, + # Space between the borders of the plot and the legend + "legend.borderaxespad": 1.0, + # Lines settings + "lines.linewidth": 3.3, + "lines.markeredgewidth": 1.5, + "lines.markersize": 16, + "lines.elinewidth": 1.5, + # Saved figure settings + "savefig.bbox": "tight", + "savefig.pad_inches": 0.3, + "savefig.format": "pdf", + # Ticks settings + # xticks + "xtick.minor.visible": True, + "xtick.top": True, + "xtick.major.size": 14, + "xtick.minor.size": 7, + "xtick.major.width": 2, + "xtick.minor.width": 2, + "xtick.major.pad": 10, + "xtick.minor.pad": 10, + "xtick.labelsize": 30, + "xtick.direction": "in", + # yticks + "ytick.minor.visible": True, + "ytick.right": True, + "ytick.major.size": 14, + "ytick.minor.size": 7, + "ytick.major.width": 2, + "ytick.minor.width": 2, + "ytick.major.pad": 10, + "ytick.minor.pad": 10, + "ytick.labelsize": 30, + "ytick.direction": "in", + # Legend frame border size + # WARNING: this affects every patch object + # (i.e. histograms and so on) + "patch.linewidth": 2, + "xaxis.labellocation": "right", + "yaxis.labellocation": "top", +} + +# Filter extra (labellocation) items if needed +LHCb3 = {k: v for k, v in LHCb3.items() if k in mpl.rcParams} + +LHCbTex3 = { + **LHCb3, + # Use LaTeX rendering by default + # (overrides default font) + "text.usetex": True, + # Use the LaTeX version of Times New Roman + "text.latex.preamble": r"\usepackage{txfonts}", + "pgf.rcfonts": False, +} + # alias LHCb Style LHCb = copy.deepcopy(LHCb2) diff --git a/tests/baseline/test_style_lhcb3.png b/tests/baseline/test_style_lhcb3.png new file mode 100644 index 00000000..030bee75 Binary files /dev/null and b/tests/baseline/test_style_lhcb3.png differ diff --git a/tests/test_styles.py b/tests/test_styles.py index a857cc7d..99e0f87b 100644 --- a/tests/test_styles.py +++ b/tests/test_styles.py @@ -112,9 +112,22 @@ def test_style_plothist(): mh.style.DUNE, mh.style.LHCb1, mh.style.LHCb2, + mh.style.LHCb3, + mh.style.LHCb, mh.style.ROOT, ], - ids=["ALICE", "ATLAS", "CMS", "DUNE1", "DUNE", "LHCb1", "LHCb2", "ROOT"], + ids=[ + "ALICE", + "ATLAS", + "CMS", + "DUNE1", + "DUNE", + "LHCb1", + "LHCb2", + "LHCb3", + "LHCb", + "ROOT", + ], ) def test_use_style(fig_test, fig_ref, mplhep_style): mh.rcParams.clear() @@ -150,9 +163,22 @@ def test_use_style_LHCb_default(fig_test, fig_ref): (mh.style.DUNE, "DUNE"), (mh.style.LHCb1, "LHCb1"), (mh.style.LHCb2, "LHCb2"), + (mh.style.LHCb2, "LHCb3"), + (mh.style.LHCb2, "LHCb"), (mh.style.ROOT, "ROOT"), ], - ids=["ALICE", "ATLAS", "CMS", "DUNE1", "DUNE", "LHCb1", "LHCb2", "ROOT"], + ids=[ + "ALICE", + "ATLAS", + "CMS", + "DUNE1", + "DUNE", + "LHCb1", + "LHCb2", + "LHCb3", + "LHCb", + "ROOT", + ], ) def test_use_style_str_alias(fig_test, fig_ref, mplhep_style, str_alias): mh.rcParams.clear() @@ -176,9 +202,22 @@ def test_use_style_str_alias(fig_test, fig_ref, mplhep_style, str_alias): (mh.style.DUNE, "DUNE"), (mh.style.LHCb1, "LHCb1"), (mh.style.LHCb2, "LHCb2"), + (mh.style.LHCb2, "LHCb3"), + (mh.style.LHCb2, "LHCb"), (mh.style.ROOT, "ROOT"), ], - ids=["ALICE", "ATLAS", "CMS", "DUNE1", "DUNE", "LHCb1", "LHCb2", "ROOT"], + ids=[ + "ALICE", + "ATLAS", + "CMS", + "DUNE1", + "DUNE", + "LHCb1", + "LHCb2", + "LHCb3", + "LHCb", + "ROOT", + ], ) def test_use_style_self_consistent(fig_test, fig_ref, mplhep_style, str_alias): mh.rcParams.clear() @@ -202,9 +241,22 @@ def test_use_style_self_consistent(fig_test, fig_ref, mplhep_style, str_alias): (mh.style.DUNE, "DUNE"), (mh.style.LHCb1, "LHCb1"), (mh.style.LHCb2, "LHCb2"), + (mh.style.LHCb2, "LHCb3"), + (mh.style.LHCb2, "LHCb"), (mh.style.ROOT, "ROOT"), ], - ids=["ALICE", "ATLAS", "CMS", "DUNE1", "DUNE", "LHCb1", "LHCb2", "ROOT"], + ids=[ + "ALICE", + "ATLAS", + "CMS", + "DUNE1", + "DUNE", + "LHCb1", + "LHCb2", + "LHCb3", + "LHCb", + "ROOT", + ], ) def test_use_style_style_list(fig_test, fig_ref, mplhep_style, str_alias): mh.rcParams.clear()