Tutorial VI: Advanced Plotting - KIT-CMS/Artus GitHub Wiki

This tutorial is based on the ROOT files generated in the first step.

General plotting styles

Labels and legends

Axis labels are set via the parameters --x-label/-y-label/--z-label. The title of the plot can be set with --title. The entries in the legend are set with --labels, which should take as many values as objects have to be plotted. The legend itself is controlled with --legend. All labeling options accept plain strings and/or Latex formulas.

  • PlotRoot module

    In the PlotRoot module the Latex syntax has to follow the special TLatex rules. Formulas must not be put in $...$. The --legend parameter takes four values: x_min, y_min, x_max and y_max. These values range from 0 (left/bottom) to 1 (right/top of the plot boundaries). The number of columns is controlled via --legend-cols. The style of the markers in the legend has to be adjusted manually, see section Markers.

     harry.py --plot-modules PlotRoot --x-label "Resolution #sigma=x_{gen}-x_{reco}" --y-label "Events #frac{dN}{d#sigma}" --title "#mu#tau_{had} Channel" --labels Data "Z#rightarrow#tau#tau" "Other Bkg." --legend 0.2 0.7 0.5 0.9 -i gaussians3.root -f gaussians1 gaussians2 gaussians3 -x var0
    

  • PlotMpl module

     harry.py --plot-modules PlotMpl --x-label "Resolution \$\sigma=x_\mathrm{gen}-x_\mathrm{reco}\$" --y-label "Events \$\frac{\mathrm{d}N}{\mathrm{d}\sigma}\$" --title "$\mu\tau_\mathrm{had}$ Channel" --labels Data "\$Z\rightarrow\tau\tau\$" "Other Bkg." --legend best -i gaussians3.root -f gaussians1 gaussians2 gaussians3 -x var0
    

Markers

  • PlotRoot module

    In the PlotRoot module the drawing option for the functions TH1.Draw, TGraph.Draw and TF1.Draw are always specified by the values of the -m/--markers arguments. The possible values (for histograms and graphs) are documented in the corresponding THistPainter and TGraphPainter classes of ROOT.

     harry.py --plot-modules PlotRoot -m HIST E2 E LINE --legend-markers F F ELP L -i gaussians3.root gaussians3.root gaussians3.root gaussians1000.root -f gaussians1 gaussians2 gaussians3 gaussians -x var0 --labels " -m HIST --legend-markers F" " -m E2 --legend-markers F" " -m E --legend-markers ELP" " -m LINE --legend-markers L" --legend 0.2 0.6 0.5 0.9 -C kRed-10 1 1 2
    

    The marker styles and widths are set with --marker-styles/--marker-sizes. Possible values are documented in the TAttMarker class of ROOT. In cases a legend is drawn, the marker styles in the legend have to manually adjusted using --legend-markers, which takes the values documented in the TLegend.AddEntry function.

     harry.py --plot-modules PlotRoot --marker-styles 20 21 24 25 22 --marker-sizes 1.0 0.5 1.5 1.5 2.0 -m E --legend-markers ELP -i gaussians3.root -f gaussians1 -x var0 var1 var2 var3 var4 --scale-factors 1 1 1 0.5 1 --legend 0.2 0.65 0.8 0.9 --labels " --marker-styles 20 --marker-sizes 1.0" " --marker-styles 21 --marker-sizes 0.5" " --marker-styles 24 --marker-sizes 1.5" " --marker-styles 25 --marker-sizes 1.5" " --marker-styles 22 --marker-sizes 2.0"
    

  • PlotMpl module

    TODO

Lines

  • PlotRoot module

    Lines are configured with two parameters: --line-styles and --line-widths take the values documented in the class TAttLine.

     harry.py --plot-modules PlotRoot --line-styles 1 2 3 --line-widths 1 3 5 -m LINE --legend-markers L -i gaussians3.root -f gaussians1 -x var0 var1 var2 --legend 0.2 0.7 0.7 0.9 --labels " --line-styles 1 --line-widths 1" " --line-styles 2 --line-widths 3" " --line-styles 3 --line-widths 5"
    

  • PlotMpl module

    TODO

Colors

  • PlotRoot module

    Colors are configured the --colors parameter, which takes the values documented in the color wheel of the class TColors. Additionally, the format #RRGGBB is supported. In case of histograms, two values per parameter separated by a whitespace character can be evaluated. The first denotes the colors of the edges and second the one of the filled area.

     harry.py --plot-modules PlotRoot --colors 1 3 "#22FFFF" "#FF0022 kRed-10" -m E LINE HIST HIST -i gaussians3.root -f gaussians1 -x var0 --scale-factors 1.0 0.8 0.6 0.4 --labels " --colors 1" " --colors 3" " --colors \"#22FFFF\"" " --colors \"#FF0022 kRed-10\"" --legend-markers ELP L F F --legend 0.2 0.63 0.8 0.9
    

    Multidimensional plots are usually drawn with a colormap. The settings for colormaps are also read from the --colors parameter, but only after specifying --colormap, which does not take any parameter. The color can then either be a predefined ROOT color palette or a list of colors (again separated by whitespace characters), of which a color mapping should be contructed. The full value range is then split equally between the specified colors.

     harry.py --plot-modules PlotRoot --colormap --colors 1 -i gaussians3.root -f gaussians1 -x var0 -y var1 -m COLZ
     harry.py --plot-modules PlotRoot --colormap --colors "kRed kGreen kBlue" -i gaussians3.root -f gaussians1 -x var0 -y var1 -m COLZ
    

  • PlotMpl module

    TODO

Filling styles

  • PlotRoot module

    The style of filled areas is set with the --fill-styles parameter, whose values are documented in the TAttFill class.

     harry.py --plot-modules PlotRoot --fill-styles 1 3001 3004 3005 -m HIST -i gaussians3.root -f gaussians1 -x var0 var1 var2 var3 --scale-factors 4 3 2 1 --labels " --fill-styles 1" " --fill-styles 3001" " --fill-styles 3004" " --fill-styles 3005" --legend-markers F --legend 0.48 0.7 0.9 0.9
    

  • PlotMpl module

    TODO