Skip to content

Additional plotting objects

Klaas Padeken edited this page Sep 11, 2017 · 1 revision

Additional plotting objects

General

To plot additional user defined objects into your plot you first need to create the plot:

test.create_plot()

Then you can get the axis of the plot where you want to add something:

test.Get_axis1()

The you can add your preferred custom object to this axis. At the moment this custom plotter are collected in the object_plotting.py file in the PlotLib repository. Therefore it is useful to include this file in your plotter if you want to use the functionality:

from object_plotting import *

Cut markers

As a first example some functions to draw cut markers into your plot are included (draw a line at the cut value and an arrow indicating the cut direction). The first function draws an upper cut:

plot_upper_cuts(test.Get_axis1(),0.1)

The second one a lower cut:

plot_lower_cuts(test.Get_axis1(),0.1, -0.2)

And of course you can have them combined (for this functionality you could also just call both previous functions):

plot_both_cuts(test.Get_axis1(),0.1, -0.2, include = False)

An example plot with upper and lower cut would then look like this example

Gauss fit

If you want to also fit a gaussian and plot it into your figure you can use this function:

plot_gauss_fit(test.Get_axis1(), bghists.getHistList()[0], xmin = -0.5, xmax = 0.5)

Which gets the axis where the plot should appear, the histogram which will be used for the fit and the fitting range. The result should then look like this example

Clone this wiki locally