Skip to content

Styling and Customization¤

This section covers additional information about styling.

Prerequisites

Throughout this guide the following codeblock is assumed.

import matplotlib.pyplot as plt
import numpy as np
import hist
np.random.seed(42)
import mplhep as mh
# mh.style.use('<as appropriate>')

Setting experiment styles¤

Styles are applied globally using mh.style.use(), which is just a thin wrapper on plt.style.use(), with some extra goodies:

mh.style.use()

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)

Styles are simple dictionaries that configure mpl.rcParams.

mh.style.use()

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)
print()

By passing a list ["CMS", {...}] users can overwrite settings as they see fit.

mh.style.use([{}, {"font.size": 10,}])

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)
mh.style.use('plothist')

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)

Styles are simple dictionaries that configure mpl.rcParams.

mh.style.use(mh.style.plothist)

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)
print(mh.style.plothist)
{'figure.figsize': (6, 4), 'figure.facecolor': 'white', 'font.size': 15, 'xtick.labelsize': 15, 'ytick.labelsize': 15, 'axes.labelsize': 18, 'legend.fontsize': 12, 'text.usetex': False, 'font.family': ['serif', 'sans-serif'], 'font.serif': ['Latin Modern Math', 'Latin Modern Roman'], 'font.sans-serif': ['Latin Modern Sans'], 'mathtext.fontset': 'cm', 'mathtext.default': 'regular', 'legend.frameon': False, 'legend.framealpha': 0.5, 'xtick.direction': 'in', 'ytick.direction': 'in', 'xtick.minor.visible': True, 'ytick.minor.visible': True, 'ytick.left': True, 'ytick.right': False, 'xtick.top': False, 'xtick.bottom': True, 'xtick.major.size': 6, 'ytick.major.size': 6, 'xtick.minor.size': 3, 'ytick.minor.size': 3, 'xtick.major.pad': 8.0, 'ytick.major.pad': 5.0, 'axes.axisbelow': False, 'image.cmap': 'viridis', 'grid.linestyle': '-', 'lines.solid_capstyle': 'round', 'axes.grid': False, 'axes.facecolor': 'white', 'axes.linewidth': 1, 'axes.formatter.limits': (-4, 4), 'axes.prop_cycle': cycler('color', ['#348ABD', '#E24A33', '#988ED5', '#777777', '#FBC15E', '#8EBA42', '#FFB5B8']), 'axes.formatter.use_mathtext': True, 'axes.formatter.useoffset': False, 'axes.labelpad': 6, 'errorbar.capsize': 0}

By passing a list ["CMS", {...}] users can overwrite settings as they see fit.

mh.style.use([mh.style.plothist, {"font.size": 10,}])

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)
mh.style.use('CMS')

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)

Styles are simple dictionaries that configure mpl.rcParams.

mh.style.use(mh.style.CMS)

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)
print(mh.style.CMS)
{'axes.prop_cycle': cycler('color', ['#5790fc', '#f89c20', '#e42536', '#964a8b', '#9c9ca1', '#7a21dd']), 'font.sans-serif': ['TeX Gyre Heros', 'Helvetica', 'Arial'], 'font.family': 'sans-serif', 'mathtext.fontset': 'custom', 'mathtext.rm': 'TeX Gyre Heros', 'mathtext.bf': 'TeX Gyre Heros:bold', 'mathtext.sf': 'TeX Gyre Heros', 'mathtext.it': 'TeX Gyre Heros:italic', 'mathtext.tt': 'TeX Gyre Heros', 'mathtext.cal': 'TeX Gyre Heros', 'mathtext.default': 'regular', 'figure.figsize': (10.0, 10.0), 'font.size': 26, 'axes.labelsize': 'medium', 'axes.unicode_minus': False, 'xtick.labelsize': 'small', 'ytick.labelsize': 'small', 'legend.fontsize': 'small', 'legend.handlelength': 1.5, 'legend.borderpad': 0.5, 'legend.frameon': False, 'xtick.direction': 'in', 'xtick.major.size': 12, 'xtick.minor.size': 6, 'xtick.major.pad': 6, 'xtick.top': True, 'xtick.major.top': True, 'xtick.major.bottom': True, 'xtick.minor.top': True, 'xtick.minor.bottom': True, 'xtick.minor.visible': True, 'ytick.direction': 'in', 'ytick.major.size': 12, 'ytick.minor.size': 6.0, 'ytick.right': True, 'ytick.major.left': True, 'ytick.major.right': True, 'ytick.minor.left': True, 'ytick.minor.right': True, 'ytick.minor.visible': True, 'grid.alpha': 0.8, 'grid.linestyle': ':', 'axes.linewidth': 2, 'savefig.transparent': False, 'xaxis.labellocation': 'right', 'yaxis.labellocation': 'top'}

By passing a list ["CMS", {...}] users can overwrite settings as they see fit.

mh.style.use([mh.style.CMS, {"font.size": 10,}])

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)
mh.style.use('ATLAS')

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)

Styles are simple dictionaries that configure mpl.rcParams.

mh.style.use(mh.style.ATLAS)

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)
print(mh.style.ATLAS)
{'font.size': 14, 'font.family': 'sans-serif', 'font.sans-serif': ['TeX Gyre Heros', 'helvetica', 'Helvetica', 'Nimbus Sans L', 'Mukti Narrow', 'FreeSans'], 'font.serif': ['Tex Gyre Termes', 'Times', 'Times Roman', 'Times New Roman', 'Nimbus Roman'], 'font.monospace': ['Tex Gyre Cursor', 'Courier', 'Courier New', 'Nimbus Mono'], 'figure.figsize': (8.0, 6.0), 'figure.dpi': 100, 'figure.facecolor': '#FFFFFF', 'figure.subplot.bottom': 0.16, 'figure.subplot.top': 0.93, 'figure.subplot.left': 0.16, 'figure.subplot.right': 0.95, 'axes.titlesize': 'xx-large', 'axes.labelsize': 'x-large', 'axes.linewidth': 1, 'axes.grid': False, 'axes.axisbelow': False, 'axes.labelpad': 10, 'axes.facecolor': '#FFFFFF', 'axes.labelcolor': '#000000', 'axes.formatter.limits': '-2, 4', 'axes.formatter.use_mathtext': True, 'axes.autolimit_mode': 'round_numbers', 'axes.unicode_minus': False, 'axes.xmargin': 0.0, 'xaxis.labellocation': 'right', 'yaxis.labellocation': 'top', 'xtick.direction': 'in', 'xtick.minor.visible': True, 'xtick.top': True, 'xtick.bottom': True, 'xtick.major.top': True, 'xtick.major.bottom': True, 'xtick.minor.top': True, 'xtick.minor.bottom': True, 'xtick.labelsize': 'large', 'xtick.major.size': 5, 'xtick.minor.size': 3, 'xtick.color': '#000000', 'ytick.direction': 'in', 'ytick.left': True, 'ytick.right': True, 'ytick.major.left': True, 'ytick.major.right': True, 'ytick.minor.left': True, 'ytick.minor.right': True, 'ytick.minor.visible': True, 'ytick.labelsize': 'large', 'ytick.major.size': 14, 'ytick.minor.size': 7, 'lines.linewidth': 2, 'lines.markersize': 8, 'legend.numpoints': 1, 'legend.fontsize': 'medium', 'legend.title_fontsize': 'medium', 'legend.labelspacing': 0.3, 'legend.frameon': False, 'legend.handlelength': 2, 'legend.borderpad': 1.0, 'savefig.transparent': False, 'axes.prop_cycle': cycler('color', ['#d55e00', '#56b4e9', '#e69f00', '#f0e442', '#009e73', '#cc79a7', '#0072b2']), 'mathtext.fontset': 'custom', 'mathtext.rm': 'TeX Gyre Heros', 'mathtext.bf': 'TeX Gyre Heros:bold', 'mathtext.sf': 'TeX Gyre Heros', 'mathtext.it': 'TeX Gyre Heros:italic', 'mathtext.tt': 'TeX Gyre Heros', 'mathtext.cal': 'TeX Gyre Heros', 'mathtext.default': 'it'}

By passing a list ["CMS", {...}] users can overwrite settings as they see fit.

mh.style.use([mh.style.ATLAS, {"font.size": 10,}])

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)
mh.style.use('LHCb2')

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)

Styles are simple dictionaries that configure mpl.rcParams.

mh.style.use(mh.style.LHCb2)

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)
print(mh.style.LHCb2)
{'axes.labelsize': 32, 'axes.linewidth': 2, 'axes.facecolor': 'white', 'axes.xmargin': 0.0, 'axes.prop_cycle': cycler('color', ['#0078FF', '#FF6600', '#0AAFB6', '#FF3333', '#0000FF', '#00CC00', '#BF8040', '#FF33CC', '#FF7733', '#BFD1D4']), 'axes.formatter.min_exponent': 3, 'axes.titlesize': 28, 'errorbar.capsize': 2.5, 'figure.figsize': (12, 9), 'figure.dpi': 100, 'figure.facecolor': 'white', 'figure.autolayout': True, '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, 'legend.frameon': False, 'legend.fancybox': True, 'legend.facecolor': 'inherit', 'legend.numpoints': 1, 'legend.labelspacing': 0.2, 'legend.fontsize': 28, 'legend.title_fontsize': 28, 'legend.loc': 'best', 'legend.handletextpad': 0.75, 'legend.borderaxespad': 1.0, 'lines.linewidth': 3.3, 'lines.markeredgewidth': 1.5, 'lines.markersize': 16, 'savefig.bbox': 'tight', 'savefig.pad_inches': 0.1, 'savefig.format': 'pdf', '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', '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', 'patch.linewidth': 2, 'xaxis.labellocation': 'right', 'yaxis.labellocation': 'top'}

By passing a list ["CMS", {...}] users can overwrite settings as they see fit.

mh.style.use([mh.style.LHCb2, {"font.size": 10,}])

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)
mh.style.use('ALICE')

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)

Styles are simple dictionaries that configure mpl.rcParams.

mh.style.use(mh.style.ALICE)

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)
print(mh.style.ALICE)
{'lines.linewidth': 1, 'font.family': 'sans-serif', 'font.sans-serif': ['TeX Gyre Heros', 'Helvetica', 'Arial'], 'font.size': 14, 'mathtext.fontset': 'stixsans', 'mathtext.default': 'rm', 'figure.figsize': (12.0, 9.0), 'figure.facecolor': 'white', 'figure.subplot.bottom': 0.16, 'figure.subplot.top': 0.93, 'figure.subplot.left': 0.16, 'figure.subplot.right': 0.95, 'axes.labelsize': 32, 'axes.labelpad': 24, 'xtick.top': True, 'xtick.labelsize': 25, 'xtick.major.size': 10, 'xtick.minor.size': 5, 'xtick.direction': 'in', 'xtick.minor.visible': True, 'ytick.right': True, 'ytick.labelsize': 25, 'ytick.major.size': 14, 'ytick.minor.size': 7, 'ytick.direction': 'in', 'ytick.minor.visible': True, 'lines.markersize': 8, 'legend.loc': 'best', 'legend.numpoints': 1, 'legend.fontsize': 28, 'legend.labelspacing': 0.3, 'legend.frameon': False, 'xaxis.labellocation': 'right', 'yaxis.labellocation': 'top'}

By passing a list ["CMS", {...}] users can overwrite settings as they see fit.

mh.style.use([mh.style.ALICE, {"font.size": 10,}])

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)
mh.style.use('DUNE')

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)

Styles are simple dictionaries that configure mpl.rcParams.

mh.style.use(mh.style.DUNE)

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)
print(mh.style.DUNE)
{'font.sans-serif': ['TeX Gyre Heros', 'Helvetica', 'Helvetica Neue', 'Nimbus Sans L', 'Liberation Sans', 'Arial', 'FreeSans'], 'font.family': 'sans-serif', 'mathtext.fontset': 'custom', 'mathtext.rm': 'TeX Gyre Heros', 'mathtext.bf': 'TeX Gyre Heros:bold', 'mathtext.sf': 'TeX Gyre Heros', 'mathtext.it': 'TeX Gyre Heros:italic', 'mathtext.tt': 'TeX Gyre Heros', 'mathtext.cal': 'TeX Gyre Heros', 'mathtext.default': 'regular', 'figure.figsize': (10, 10), 'figure.facecolor': 'white', 'figure.dpi': 100, 'figure.autolayout': True, 'text.hinting_factor': 8, 'font.size': 22, 'axes.facecolor': 'white', 'axes.edgecolor': 'black', 'axes.grid': False, 'axes.linewidth': 1.5, 'axes.labelsize': 'medium', 'axes.titlesize': 36, 'axes.formatter.use_mathtext': True, 'axes.unicode_minus': False, 'axes.xmargin': 0.0, 'axes.prop_cycle': cycler('color', ['#000000', '#D55E00', '#56B4E9', '#E69F00', '#009E73', '#CC79A7', '#0072B2', '#F0E442']), 'lines.linewidth': 2.0, 'lines.markersize': 8, 'patch.linewidth': 1.5, 'patch.facecolor': 'blue', 'patch.edgecolor': 'black', 'patch.antialiased': True, 'image.cmap': 'cividis', 'image.aspect': 'auto', 'grid.color': '#b2b2b2', 'grid.linestyle': ':', 'grid.linewidth': 0.5, 'grid.alpha': 0.8, 'legend.fontsize': 12, 'legend.title_fontsize': 'large', 'legend.frameon': False, 'legend.handlelength': 2.0, 'legend.borderpad': 0.8, 'legend.columnspacing': 1.0, 'legend.labelspacing': 0.5, 'legend.loc': 'best', 'xtick.color': 'black', 'xtick.direction': 'in', 'xtick.labelsize': 'small', 'xtick.major.size': 10, 'xtick.minor.size': 5, 'xtick.major.pad': 6, 'xtick.minor.visible': True, 'xtick.top': True, 'xtick.bottom': True, 'xtick.major.top': True, 'xtick.major.bottom': True, 'xtick.minor.top': True, 'xtick.minor.bottom': True, 'ytick.color': 'black', 'ytick.direction': 'in', 'ytick.labelsize': 'small', 'ytick.major.size': 10, 'ytick.minor.size': 5, 'ytick.major.pad': 6, 'ytick.minor.visible': True, 'ytick.right': True, 'ytick.left': True, 'ytick.major.left': True, 'ytick.major.right': True, 'ytick.minor.left': True, 'ytick.minor.right': True, 'xaxis.labellocation': 'right', 'yaxis.labellocation': 'top', 'savefig.transparent': False, 'savefig.bbox': 'tight'}

By passing a list ["CMS", {...}] users can overwrite settings as they see fit.

mh.style.use([mh.style.DUNE, {"font.size": 10,}])

fig, ax = plt.subplots()
mh.histplot([1, 2, 3, 6, 3, 5, 2, 1], ax=ax)

Warning

Due to matplotlib limitations, with plt.style.context() does not work reliably with mplhep styles, especially for fonts. Use mh.style.use() globally instead.

Setting experiment labels¤

Each experiment style comes with a matching label function that formats experiment names, status text, and run information according to that experiment's guidelines:

Default for most experiments. Label appears above the plot area, left aligned.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
# No label function for default style

Compact single-line format in the top left corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
# No label function for default style

Multiline format in the top left corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
# No label function for default style

Experiment name above axes, secondary text in corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
# No label function for default style

Style-specific layout (e.g., ATLAS places luminosity below).

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
# No label function for default style

Default for most experiments. Label appears above the plot area, left aligned.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
# No label function for default style

Compact single-line format in the top left corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
# No label function for default style

Multiline format in the top left corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
# No label function for default style

Experiment name above axes, secondary text in corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
# No label function for default style

Style-specific layout (e.g., ATLAS places luminosity below).

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
# No label function for default style

Default for most experiments. Label appears above the plot area, left aligned.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.cms.label('Preliminary', data=True, lumi=100, ax=ax, loc=0, supp='arXiv:2024.12345')

Compact single-line format in the top left corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.cms.label('Preliminary', data=True, lumi=100, ax=ax, loc=1, supp='arXiv:2024.12345')

Multiline format in the top left corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.cms.label('Preliminary', data=True, lumi=100, ax=ax, loc=2, supp='arXiv:2024.12345')

Experiment name above axes, secondary text in corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.cms.label('Preliminary', data=True, lumi=100, ax=ax, loc=3, supp='arXiv:2024.12345')

Style-specific layout (e.g., ATLAS places luminosity below).

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.cms.label('Preliminary', data=True, lumi=100, ax=ax, loc=4, supp='arXiv:2024.12345')

Default for most experiments. Label appears above the plot area, left aligned.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.atlas.label('Preliminary', data=True, lumi=150, ax=ax, loc=0, supp='arXiv:2024.12345')

Compact single-line format in the top left corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.atlas.label('Preliminary', data=True, lumi=150, ax=ax, loc=1, supp='arXiv:2024.12345')

Multiline format in the top left corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.atlas.label('Preliminary', data=True, lumi=150, ax=ax, loc=2, supp='arXiv:2024.12345')

Experiment name above axes, secondary text in corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.atlas.label('Preliminary', data=True, lumi=150, ax=ax, loc=3, supp='arXiv:2024.12345')

Style-specific layout (e.g., ATLAS places luminosity below).

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.atlas.label('Preliminary', data=True, lumi=150, ax=ax, loc=4, supp='arXiv:2024.12345')

Default for most experiments. Label appears above the plot area, left aligned.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.lhcb.label('Preliminary', data=True, lumi=50, ax=ax, loc=0, supp='arXiv:2024.12345')

Compact single-line format in the top left corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.lhcb.label('Preliminary', data=True, lumi=50, ax=ax, loc=1, supp='arXiv:2024.12345')

Multiline format in the top left corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.lhcb.label('Preliminary', data=True, lumi=50, ax=ax, loc=2, supp='arXiv:2024.12345')

Experiment name above axes, secondary text in corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.lhcb.label('Preliminary', data=True, lumi=50, ax=ax, loc=3, supp='arXiv:2024.12345')

Style-specific layout (e.g., ATLAS places luminosity below).

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.lhcb.label('Preliminary', data=True, lumi=50, ax=ax, loc=4, supp='arXiv:2024.12345')

Default for most experiments. Label appears above the plot area, left aligned.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.alice.label('Preliminary', data=True, lumi=100, ax=ax, loc=0, supp='arXiv:2024.12345')

Compact single-line format in the top left corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.alice.label('Preliminary', data=True, lumi=100, ax=ax, loc=1, supp='arXiv:2024.12345')

Multiline format in the top left corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.alice.label('Preliminary', data=True, lumi=100, ax=ax, loc=2, supp='arXiv:2024.12345')

Experiment name above axes, secondary text in corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.alice.label('Preliminary', data=True, lumi=100, ax=ax, loc=3, supp='arXiv:2024.12345')

Style-specific layout (e.g., ATLAS places luminosity below).

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.alice.label('Preliminary', data=True, lumi=100, ax=ax, loc=4, supp='arXiv:2024.12345')

Default for most experiments. Label appears above the plot area, left aligned.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.dune.label('Preliminary', data=True, lumi=100, ax=ax, loc=0, supp='arXiv:2024.12345')

Compact single-line format in the top left corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.dune.label('Preliminary', data=True, lumi=100, ax=ax, loc=1, supp='arXiv:2024.12345')

Multiline format in the top left corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.dune.label('Preliminary', data=True, lumi=100, ax=ax, loc=2, supp='arXiv:2024.12345')

Experiment name above axes, secondary text in corner.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.dune.label('Preliminary', data=True, lumi=100, ax=ax, loc=3, supp='arXiv:2024.12345')

Style-specific layout (e.g., ATLAS places luminosity below).

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.dune.label('Preliminary', data=True, lumi=100, ax=ax, loc=4, supp='arXiv:2024.12345')

Configuring experiment labels¤

Additional configuration options for experiment labels:

Combine multiple standard parameters for complete label information.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
# No label function for default style

Use llabel and rlabel for complete control over label content.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
# No label function for default style

Combine multiple standard parameters for complete label information.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
txt_obj = mh.add_text('plothist', loc='over left', ax=ax)

Use llabel and rlabel for complete control over label content.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
txt_obj = mh.add_text('Custom Text', loc='over left', ax=ax)

Combine multiple standard parameters for complete label information.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.cms.label('Preliminary', data=True, year='2023', lumi=137.2, com=13, lumi_format='{0:.1f}', ax=ax)

Use llabel and rlabel for complete control over label content.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.cms.label(llabel='Left Label', rlabel='Right Label', ax=ax)

Combine multiple standard parameters for complete label information.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.atlas.label('Preliminary', data=True, year='2023', lumi=150, com=13, lumi_format='{0:.0f}', ax=ax)

Use llabel and rlabel for complete control over label content.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.atlas.label(llabel='Left Label', rlabel='Right Label', ax=ax)

Combine multiple standard parameters for complete label information.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.lhcb.label('Preliminary', data=True, year='2023', lumi=50, com=13, lumi_format='{0:.0f}', ax=ax)

Use llabel and rlabel for complete control over label content.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.lhcb.label(llabel='Left Label', rlabel='Right Label', ax=ax)

Combine multiple standard parameters for complete label information.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.alice.label('Preliminary', data=True, year='2023', lumi=100, com=13, lumi_format='{0:.0f}', ax=ax)

Use llabel and rlabel for complete control over label content.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.alice.label(llabel='Left Label', rlabel='Right Label', ax=ax)

Combine multiple standard parameters for complete label information.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.dune.label('Preliminary', data=True, year='2023', lumi=100, lumi_format='{0:.0f}', ax=ax)

Use llabel and rlabel for complete control over label content.

fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
mh.dune.label(llabel='Left Label', rlabel='Right Label', ax=ax)