fast-plotter¶
To install:
pip install fast-plotter
Or for development:
pip install -e git+https://gitlab.cern.ch/fast-hep/public/fast-plotter.git#egg=fast-plotter
- Free software: Apache Software License 2.0
Features¶
- Functions to turn binned dataframes in the form produced from fast-carpenter
- A simple command-line tool to produce plots with decent defaults
Command-line Usage¶
The command-line tools are the primary way to use fast-carpenter and friends at this point.
All of the FAST commands provide built-in help by providing the --help
option.
fast_plotter
¶
Take a list of fast-carpenter output binned dataframe tables and turns these into plots.
To configure how these plots are made, use either the command-line options, or provide these in a YAML configuration. If an option is provided to both, then the command-line value will take precedence.
$ fast_plotter --help
usage: fast_plotter [-h] [-c CONFIG] [-o OUTDIR] [-e EXTENSION] [-w WEIGHTS]
[-d DATA] [-s SIGNAL] [--dataset-col DATASET_COL]
[-l LUMI] [-y {log,linear}] [--halt-errors]
tables [tables ...]
Turn them tables into plots
positional arguments:
tables Table files to process
optional arguments:
-h, --help show this help message and exit
-c CONFIG, --config CONFIG
YAML config to control common plotting options
-o OUTDIR, --outdir OUTDIR
Output directory to save plots to
-e EXTENSION, --extension EXTENSION
File extension for images
-w WEIGHTS, --weights WEIGHTS
comma-separated list of weight schemes to plot things
for
-d DATA, --data DATA Regular expression to identify real data datasets from
their name
-s SIGNAL, --signal SIGNAL
Regular expression to identify signal MC datasets from
their name
--dataset-col DATASET_COL
Name of column to be used to define multiple-lines for
1D plots
-l LUMI, --lumi LUMI Scale the MC yields by this lumi
-y {log,linear}, --yscale {log,linear}
Use this scale for the y-axis
--halt-errors Stop at the first time an error occurs
The Plotting Config¶
Use the config file to fine-tune your plots.
Valid options:
Option Default Description data
"data"
Regular expression for values in dataset_col toplot as scatter markersweights
None
Which weight columns to use for plotting. yscale
"linear"
Should y-axis be on a linear
or alog
scale.lumi
1
Multiply all simulated datasets by this value. ylabel
Give the Y-axis a title. legend
Control the legend placement options. A dictionary ofkwarg pairs passed directly tomatplotlib.pyplot.legend()
limits
Set the axis ranges. Takes a dictionary withx
and / ory
asthe keys, and a list with upper and lower bounds.annotations
Add text to the plot. Should be a list of text labels, each describedby a dictionary containing thetext
and theposition
. Allother paramers are passed as keyword-argument pairs to
Todo
Describe the bin_variable_replacements
and value_replacements
options for the config.
See also
An example of a plotting config cms_public_tutorial demo repository: https://gitlab.cern.ch/fast-hep/public/fast_cms_public_tutorial/blob/master/plot_config.yml
Example repositories¶
- A full demo based on the public CMS tutorial using 2012 data: https://gitlab.cern.ch/fast-hep/public/fast_cms_public_tutorial
fast_plotter package¶
Submodules¶
fast_plotter.interval_from_str module¶
fast_plotter.plotting module¶
-
class
fast_plotter.plotting.
FillColl
(n_colors=10, ax=None, fill=True, line=True)[source]¶ Bases:
object
-
fast_plotter.plotting.
actually_plot
(df, x_axis, y, yerr, kind, label, ax, dataset_col='dataset')[source]¶
-
fast_plotter.plotting.
plot_1d_many
(df, prefix='', data='data', signal=None, dataset_col='dataset', plot_sims='stack', plot_data='sum', plot_signal=None, kind_data='scatter', kind_sims='fill-error-last', kind_signal='line', scale_sims=None, summary='ratio')[source]¶