Graph¶
-
class
Graph.
Graph
(name='Graph_5ee80fb0', *args, **kwargs)[source]¶ Bases:
MethodProxy.MethodProxy
,TGraphAsymmErrors
Class for displaying arrays of 2-dimensional coordinates.
Inherits from ROOT.TGraphAsymmErrors
, see official documentation as well!In order to avoid memory leaks, name is an inaccessible property despite having corresponding getter and setter methods. Furthermore the properties xtitle, ytitle and ztitle are defined to be exclusive to the
Pad
class.-
__init__
(name='Graph_5ee80fb0', *args, **kwargs)[source]¶ Initialize a graph.
Create an instance of
Graph
with the specified name from two arrays of equal length.Parameters: - name (
str
) – name of the graph - *args – see below
- **kwargs –
Graph
properties
Arguments: The first and optional argument is title of the graph given by a
str
.Depending on the total number of arguments (besides name and the optional title) there are two ways to initialize a
Graph
object:one argument:
- graph (
Graph
,TGraph
,TGraphAsymmErrors
) – graph to be copied
- graph (
two arguments:
xvalues (
list
) – list of x-values which can be either of typefloat
ortuple
/list
; in the latter case depending on the length of thetuple
/list
the entries are interpreted as:- nominal x-value
- nominal x-value, (sym.) uncertainty
- nominal x-value, up-, down-uncertainty
yvalues (
list
) – list of y-values which can be either of typefloat
ortuple
/list
(see above)
- name (
-
Print
(path, **kwargs)[source]¶ Print the graph to a file.
Creates 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 to
True
(default:False
) directories in path with do not yet exist will be created automatically. The styling of the graph, pad and canvas can be configured via their respective properties passed as keyword arguments.Parameters: Keyword Arguments:
- inject (
list
,tuple
,ROOT.TObject
) – inject a (list of) drawableROOT
object(s) to the main pad, 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 (
-
SetDrawOption
(option)[source]¶ Define the draw option for the graph.
Parameters: option ( str
) – draw option (seeROOT.TGraphPainter
class reference)
-
GetPoint
(index, *args)[source]¶ Return the x- and y-value for a given index if no other arguments are given. Otherwise the standard
ROOT.TGraph.GetPoint()
functionality is used.Parameters: - index (
int
) – index of the coordinate point - *args – see
ROOT
documentation ofROOT.TGraph.GetPoint()
Returntype: tuple
for call with no additional arguments, elseNone
- index (
-