Plot¶
-
class
Plot.
Plot
(name=None, **kwargs)[source]¶ Bases:
MethodProxy.MethodProxy
Class for creating plots.
Stores
ROOT
objects like histograms and draws them in their specifiedPad
onto aCanvas
.-
__init__
(name=None, **kwargs)[source]¶ Initialize a plot.
Create an instance of
Plot
with the specified name.Parameters: - name (
str
) – name of the plot (default: random 8-digits HEX hash value) - **kwargs –
Plot
properties
- name (
-
SetNPads
(npads)[source]¶ Set the number of
Pad
s associated to the plot.This will also determine the size and layout of the underlying
Canvas
.Parameters: npads ( int
) – number of pads (default: 1)
-
Register
(object, pad=0, **kwargs)[source]¶ Register a
ROOT
object to the plot.The associated
Pad
is defined by pad. Properties of the object and the associatedPad
can be changed via keyword arguments.Parameters: - object (
ROOT.TObject
) – drawableROOT
object to be registered to the plot, e.g.Histo1D
,TH1D
,Histo2D
,TH2D
,Stack
, … - pad (
int
) – index of the target pad (default: 0) - **kwargs – object,
Pad
properties
- object (
-
Print
(path, **kwargs)[source]¶ Print the plot to a file.
Creates a
Canvas
and draws all registered objects into their associatedPad
. The canvas is saved as a PDF/PNG/… file with the absolute path defined by path. If a file with the same name already exists it will be overwritten (can be changed with the overwrite keyword argument). If mkdir is set toTrue
(default:False
) directories in path with do not yet exist will be created automatically.The properties of the of the plot and canvas can be configured via their respective properties passed as keyword arguments.
Parameters: Keyword Arguments:
- inject<N> (
list
,tuple
,ROOT.TObject
) – inject a (list of) drawableROOT
object(s) to pad <N> (default: 0), object properties can be specified by passing instead atuple
of the format(obj, props)
whereprops
is adict
holding the object properties (default: []) - overwrite (
bool
) – overwrite an existing file located at path (default:True
) - mkdir (
bool
) – create non-existing directories in path (default:False
)
- inject<N> (
-
Inject
(pad=0, *args)[source]¶ Inject a (list of) drawable object(s) to the pad with index pad.
Object properties can be specified by passing instead a
tuple
of the format(obj, props)
whereprops
is adict
holding the object properties.Parameters: - pad (
int
) – index of the target pad (default: 0) - *args (
tuple
,ROOT.TObject
) – drawableROOT
object ortuple
of the format(obj, props)
whereprops
is adict
holding the object properties
- pad (
-
SetState
(state)[source]¶ Set the plot state.
Parameters: label ( str
) – plot state (default: ‘Work In Progress’)
-
SetCME
(cme)[source]¶ Set the value of the center-of-mass energy.
Parameters: label ( int
,str
) – center-of-mass energy in TeV
-