Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/source/gallery/styles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------
Expand Down
4 changes: 3 additions & 1 deletion src/mplhep/styles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = (
Expand All @@ -38,9 +38,11 @@
"LHCb",
"LHCb1",
"LHCb2",
"LHCb3",
"LHCbTex",
"LHCbTex1",
"LHCbTex2",
"LHCbTex3",
"ROOTTex",
"fabiola",
"fira",
Expand Down
113 changes: 113 additions & 0 deletions src/mplhep/styles/lhcb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Binary file added tests/baseline/test_style_lhcb3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 56 additions & 4 deletions tests/test_styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down
Loading