permalink: /aio/index.html —
Introduction
Overview
Teaching: 60 min
Exercises: 30 minQuestions
Why to use Matplotlib for HEP?
What kind of plots can be done?
Objectives
Understand the basics of Matplotlib
Learn how to manipulate the elements of a plot
The example-based nature of Matplotlib documentation is GREAT.
Matplotlib is the standard when it comes to making plots in Python. It is versatile and allows for lots of functionality and different ways to produce many plots. We will be focusing on using matplotlib for High Energy Physics.
A simple example
As with any Python code it is always good practice to import the necessary libraries as a first step.
import matplotlib.pyplot as plt
Key Points
Matplotlib graphs data in Figures, each of which can contain components that can be manipulated: axis, legend, labels, etc.
Many kinds of plots can be produced: scatter plots, bar plots, pie charts, and many more