Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
gr004_errors_asym.py
Go to the documentation of this file.
1## \file
2## \ingroup tutorial_graphs
3## \notebook
4## \preview This tutorial demonstrates the use of TGraphAsymmErrors to plot a graph with asymmetrical errors on both the x and y axes.
5## The errors for the x values are divided into low (left side of the marker) and high (right side of the marker) errors.
6## Similarly, for the y values, there are low (lower side of the marker) and high (upper side of the marker) errors.
7##
8## \macro_image
9## \macro_code
10##
11## \author Miro Helbich, Jamie Gooding
12
13import numpy as np
14import ROOT
15
16c2 = ROOT.TCanvas("c2", "", 700, 500)
17
19npoints = 3
20xaxis = np.array([1.0, 2.0, 3.0])
21yaxis = np.array([10.0, 20.0, 30.0])
22
23exl = np.array([0.5, 0.2, 0.1]) # Lower x errors
24exh = np.array([0.5, 0.3, 0.4]) # Higher x errors
25eyl = np.array([3.0, 5.0, 4.0]) # Lower y errors
26eyh = np.array([3.0, 5.0, 4.0]) # Higher y errors
27
29 npoints, xaxis, yaxis, exl, exh, eyl, eyh
30) # Create the TGraphAsymmErrors object with data and asymmetrical errors
31
32gr.SetTitle("A simple graph with asymmetrical errors")
33gr.Draw("A*") # "A" = draw axes and "*" = draw markers at the points with error bars
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.