Skip to main content

ATLAS Matplotlib Style

https://img.shields.io/pypi/v/atlas-mpl-style?label=PyPI&style=for-the-badge:alt:PyPI

Provides a Matplotlib style replicating that used by the ATLAS collaboration.

Please open an issue if you find this style deviates from the guidelines.

Install from PyPI using pip: pip install atlas-mpl-style

Documentation: https://atlas-mpl.readthedocs.io/en/latest/index.html

In addition, this package also provides:

  • A function to draw the ATLAS label

  • A plot module containing functions to plot pre-binned histograms and

    limits. This includes functionality for plotting stacked backgrounds along with data and ratios in the usual ATLAS style.

  • An additional “Print” (white background) style.

  • Additional Matplotlib color definitions based on the ATLAS / Okabe & Ito palette, the Petroff accessible color sequences, the

    Paper theme, and the Oceanic Next theme

Example ATLAS plot

UHI and the PlottableHistogram protocol

With the development of the UHI interface, this package now has support for histogram objects that follow the PlottableHistogram protocol. plot.Background objects can be constructed using PlottableHistograms and a list of such Backgrounds can be passed to plot.plot_backgrounds omitting the bins argument. The other histogram plotting functions could not be modified to accept PlottableHistogram in a backward compatible manner since they take bins before the histogram argument. Alternate versions of these functions are therefore provided in the uhi module.

As a result of this support, the histogram objects returned by Uproot 4 can be plotted directly, as can Boost-Histogram histograms and Hist objects (once the relevent PRs are merged into those repositories).

usetex=False Mode

usetex=False is now the default, removing the LaTeX dependency.

If you convert a plotting script that uses usetex=True mode, make sure labels are updated to remove LaTeX macros that are not supported by Matplotlib’s mathtext.

TeXLive and Fonts Needed

If you have a full LaTeX installation available, you can use LaTeX to typeset the text by passing usetex=True to use_atlas_style. This will give you much greater options in terms of what can be included in labels.

A working TeXLive installation providing the following is required:

  • pdflatex

  • amsmath

  • TeX Gyre Heros

  • mathastext

  • physics (the package)

  • siunitx

If no LaTeX installation is available, the style will warn and fall back to the usetex=False behaviour. To check if all necessary packages are installed, try building atlas_mpl_style/testing/ampl-test.tex.

On Arch (and related distributions), the texlive-most group is sufficient.

On Debian (Jessie or above) or Ubuntu (18.04+), the following set of packages should be sufficient. It is however highly recommended that you install texlive-full to obtain a complete installation of texlive.

  • texlive

  • texlive-latex-extra

  • texlive-fonts-recommended

  • texlive-lang-greek

  • tex-gyre

  • dvipng

  • ghostscript

On CentOS 7, the supplied TeXLive (2012) is extremely old. TeXLive should be installed from upstream.

TeXLive is not required for the “print” style. Matplotlib resolves fonts using the following order of preference:

  • Sans-serif (default): Atkinson Hyperlegible, followed by TeX Gyre Heros, Helvetica Neue, Helvetica, Free Sans, Nimbus Sans L, Arial, and DejaVu Sans.

  • Monospace: Source Code Pro, Inconsolata, Monaco, Consolas, Ubuntu Mono, DejaVu Sans Mono.

Atkinson Hyperlegible was chosen to ensure text and numbers stay crisp and easy to read from the back of an auditorium, or if plots end up scaled down on a poster or paper.

If you prefer the previous look with Fira Sans, you can select it explicitly after activating the style:

import matplotlib.pyplot as plt
import atlas_mpl_style as ampl

plt.style.use('print')
plt.rcParams['font.sans-serif'] = ['Fira Sans'] + plt.rcParams['font.sans-serif']

Metadata

Release files for atlas-mpl-style 0.27.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for atlas-mpl-style 0.27.0
File Size Uploaded
atlas_mpl_style-0.27.0.tar.gz 37.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for atlas-mpl-style 0.27.0
File Interpreter ABI Platform
atlas_mpl_style-0.27.0-py3-none-any.whl Python 3 none any Details

Total release size: 78.3 kB

Release files / atlas_mpl_style-0.27.0.tar.gz

Download URL atlas_mpl_style-0.27.0.tar.gz
Size 37.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0285a08eb6eaef96d89a739272fe8ff8a66f8bb58ff601488123b7679a6c0e0b
BLAKE2b-256 checksum
How to use checksums
b1fbb0fbb67a75752b887e571596660f56cc9aa1604eee452ca7f963b66beafa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Release files / atlas_mpl_style-0.27.0-py3-none-any.whl

Download URL atlas_mpl_style-0.27.0-py3-none-any.whl
Size 40.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ded23f109efe6853e9099b2eecf819b5c730d109a9b345f7f0d4be7f57ace564
BLAKE2b-256 checksum
How to use checksums
2cedeb82a1026f108e42498923a73e28731c8fe1bff3ecba464f63bc6983e128
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Release history Release notifications | RSS feed

This release

0.27.0 This release

2 release files

0.25.0

2 release files

0.24.1

2 release files

0.24.0

2 release files

0.23.3

2 release files

0.23.2

2 release files

0.23.1

2 release files

0.23.0

2 release files

0.21.0

1 release file

0.20.0

2 release files

0.19.1

2 release files

0.19.0

2 release files

0.18.2

2 release files

0.18.1

2 release files

0.18.0

2 release files

0.17.3

2 release files

0.17.2

2 release files

0.17.1

2 release files

0.17.0

2 release files

0.16.3

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.12.4

2 release files

0.12.3

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.12

2 release files

0.11.4

2 release files

0.11.2

2 release files

0.11.1

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.2

1 release file

0.9.1

2 release files

0.9.0

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

1 release file

0.4

1 release file

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page