Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
bent.py
Go to the documentation of this file.
1## \file
2## \ingroup tutorial_graphs
3## \notebook -js
4## Bent error bars. Inspired from work of Olivier Couet.
5##
6## \macro_image
7## \macro_code
8##
9## \author Alberto Ferro
10
11import ROOT
12
13c1 = ROOT.TCanvas()
14n = 10
15x = ROOT.std.vector('double')()
16for i in [-0.22, 0.05, 0.25, 0.35, 0.5, 0.61,0.7,0.85,0.89,0.95]: x.push_back(i)
17y = ROOT.std.vector('double')()
18for i in [1,2.9,5.6,7.4,9,9.6,8.7,6.3,4.5,1]: y.push_back(i)
19exl = ROOT.std.vector('double')()
20for i in [.05,.1,.07,.07,.04,.05,.06,.07,.08,.05]: exl.push_back(i)
21eyl = ROOT.std.vector('double')()
22for i in [.8,.7,.6,.5,.4,.4,.5,.6,.7,.8]: eyl.push_back(i)
23exh = ROOT.std.vector('double')()
24for i in [.02,.08,.05,.05,.03,.03,.04,.05,.06,.03]: exh.push_back(i)
25eyh = ROOT.std.vector('double')()
26for i in [.6,.5,.4,.3,.2,.2,.3,.4,.5,.6]: eyh.push_back(i)
27exld = ROOT.std.vector('double')()
28for i in [.0,.0,.0,.0,.0,.0,.0,.0,.0,.0]: exld.push_back(i)
29eyld = ROOT.std.vector('double')()
30for i in [.0,.0,.05,.0,.0,.0,.0,.0,.0,.0]: eyld.push_back(i)
31exhd = ROOT.std.vector('double')()
32for i in [.0,.0,.0,.0,.0,.0,.0,.0,.0,.0]: exhd.push_back(i)
33eyhd = ROOT.std.vector('double')()
34for i in [.0,.0,.0,.0,.0,.0,.0,.0,.05,.0]: eyhd.push_back(i)
35
36gr = ROOT.TGraphBentErrors(
37 n,x.data(),y.data(),exl.data(),exh.data(),eyl.data(),eyh.data(),exld.data(),exhd.data(),eyld.data(),eyhd.data())
38
39gr.SetTitle("TGraphBentErrors Example")
40gr.SetMarkerColor(4)
41gr.SetMarkerStyle(21)
42gr.Draw("ALP")