Graph¶
-
class
Graph.Graph(name='Graph_5ee80fb0', *args, **kwargs)[source]¶ Bases:
MethodProxy.MethodProxy,TGraphAsymmErrorsClass 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
Padclass.-
__init__(name='Graph_5ee80fb0', *args, **kwargs)[source]¶ Initialize a graph.
Create an instance of
Graphwith the specified name from two arrays of equal length.Parameters: - name (
str) – name of the graph - *args – see below
- **kwargs –
Graphproperties
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
Graphobject:one argument:
- graph (
Graph,TGraph,TGraphAsymmErrors) – graph to be copied
- graph (
two arguments:
xvalues (
list) – list of x-values which can be either of typefloatortuple/list; in the latter case depending on the length of thetuple/listthe 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 typefloatortuple/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) drawableROOTobject(s) to the main pad, object properties can be specified by passing instead atupleof the format(obj, props)wherepropsis adictholding 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.TGraphPainterclass 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
ROOTdocumentation ofROOT.TGraph.GetPoint()
Returntype: tuplefor call with no additional arguments, elseNone- index (
-