Tutorial V: Plotting with ROOT and MPL - KIT-CMS/Artus GitHub Wiki
This tutorial is based on the ROOT files generated in the first step.
There are three important plotting modules in HarryPlotter: PlotRoot
, PlotMpl
and ExportRoot
. The first two generate plots using either ROOT or matplotlib functionallity. The corresponding options and settings are compared in this tutorial side-by-side. The latter module is used to write ROOT objects, that have been generated during a HarryPlotter run into ROOT files.
-
harry.py --plot-modules PlotRoot -m HIST -i gaussians3.root -f gaussians1 -x var0 harry.py --plot-modules PlotMpl -m bar -i gaussians3.root -f gaussians1 -x var0
-
harry.py --plot-modules PlotRoot -m LINE -i gaussians3.root -f gaussians1 -x var0 # harry.py --plot-modules PlotMpl <options> -i gaussians3.root -f gaussians1 -x var0
-
harry.py --plot-modules PlotRoot -m E -i gaussians3.root -f gaussians1 -x var0 harry.py --plot-modules PlotMpl -m o -i gaussians3.root -f gaussians1 -x var0
-
Stacking of histograms is controlled via the option
--stacks
, which is a plotting and not an input option. For each object to be plotted it takes an arbitrary string naming the stack(s). Objects with the same stack name are stacked. This option is independent of the actual plotting backend, namelyPlotRoot
andPlotMpl
.harry.py --stacks stack1 stack1 stack1 stack2 stack3 -i gaussians3.root -f gaussians1 -x var0 --scale-factors 0.5 0.3 0.2 1.0 0.4 --plot-modules PlotRoot -m HIST HIST HIST E LINE --labels "Scale 0.5" "Scale 0.3" "Scale 0.2" "Scale 1.0" "Scale 0.4" --legend-markers F F F ELP L --legend 0.2 0.6 0.5 0.9 harry.py --stacks stack1 stack1 stack1 stack2 stack3 -i gaussians3.root -f gaussians1 -x var0 --scale-factors 0.5 0.3 0.2 1.0 0.4 --plot-modules PlotMpl -m bar bar bar o o --labels "Scale 0.5" "Scale 0.3" "Scale 0.2" "Scale 1.0" "Scale 0.4" --legend best
-
harry.py --plot-modules PlotRoot -m COLZ -i gaussians3.root -f gaussians1 -x var0 -y var1 harry.py --plot-modules PlotMpl --colormap -i gaussians3.root -f gaussians1 -x var0 -y var1
-
harry.py --plot-modules PlotRoot -m P -i gaussians3.root -f gaussians1 -x Entry$:0.3 -y "var0:sqrt(abs(var0))" --tree-draw-options TGraphErrors -w "Entry$ < 20" harry.py --plot-modules PlotMpl -m o -i gaussians3.root -f gaussians1 -x Entry$:0.3 -y "var0:sqrt(abs(var0))" --tree-draw-options TGraphErrors -w "Entry$ < 20"
-
harry.py --plot-modules PlotRoot -m L -i gaussians3.root -f gaussians1 -x Entry$ -y var0 --tree-draw-options TGraph -w "Entry$ < 20" harry.py --plot-modules PlotMpl --line-styles - -i gaussians3.root -f gaussians1 -x Entry$ -y var0 --tree-draw-options TGraph -w "Entry$ < 20"
-
harry.py --plot-modules PlotRoot -m L --input-modules InputInteractive -x "x^2" --x-bins 100,-10,10 # harry.py --plot-modules PlotMpl <options> --input-modules InputInteractive -x "x^2" --x-bins 100,-10,10
-
harry.py --plot-modules PlotRoot -m COLZ --input-modules InputInteractive -x "x*y" --x-bins 100,-10,10 --y-bins 100,-10,10 # harry.py --plot-modules PlotMpl <options> --input-modules InputInteractive -x "x*y" --x-bins 100,-10,10 --y-bins 100,-10,10