Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

GiorgosChr/matplotlib_cern

Repository files navigation

matplotlib_cern

PyPI Downloads

A matplotlib template to generate plots similar to CERN's CMS, ATLAS, LHCb and ALICE with LaTeX fonts.

CMS plot

Requirements

For this template you will need the following:

$ sudo apt install python3 texlive-full
$ pip3 install matplotlib

Installation

matplotlib_cern is available through pip3. To install simply use

$ pip3 install matplotlib_cern

Usage

To use matplotlib_cern simply import the following packages at the beginning of your script

import matplotlib.pyplot as plt
import matplotlib_cern

Currently there are only two functions, set_template and set_plotstyle. The former sets global matplotlib parameters and the latter creates a plot according to user defined variables. To set the plot style you can pass the following arguments:

matplotlib_cern.set_template()
matplotlib_cern.set_plotstyle(text = "CMS", subtext = "Simulation", lum = "12.3", com = "13.6", plotstyle = "regular")

The default values are None for all except plotstyle = "regular". The "regular" option produces a square 8x8 plot and "residuals" produces a square 6x8 plot with a residual plot attached to the bottom of it.

Here are examples of the "regular" and "residuals" plots:

regular residuals

Citation

If you want to cite this repository you can use the following BibTex citation:

@software{matplotlib_cern,
  author = {Georgios Christou},
  month = {08},
  title = {{matplotlib_cern}},
  url = {https://github.com/GiorgosChr/matplotlib_cern},
  version = {0.1.2},
  year = {2023}
}

Future work

  • Specify experiment, luminosity and center of mass energy
  • Specify the type of plot, i.e. regular or regular with residuals