Logo ROOT   6.12/07
Reference Guide
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 
11 import ROOT
12 
13 c1 = ROOT.TCanvas()
14 n = 10
15 x = ROOT.std.vector('double')()
16 for 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)
17 y = ROOT.std.vector('double')()
18 for i in [1,2.9,5.6,7.4,9,9.6,8.7,6.3,4.5,1]: y.push_back(i)
19 exl = ROOT.std.vector('double')()
20 for i in [.05,.1,.07,.07,.04,.05,.06,.07,.08,.05]: exl.push_back(i)
21 eyl = ROOT.std.vector('double')()
22 for i in [.8,.7,.6,.5,.4,.4,.5,.6,.7,.8]: eyl.push_back(i)
23 exh = ROOT.std.vector('double')()
24 for i in [.02,.08,.05,.05,.03,.03,.04,.05,.06,.03]: exh.push_back(i)
25 eyh = ROOT.std.vector('double')()
26 for i in [.6,.5,.4,.3,.2,.2,.3,.4,.5,.6]: eyh.push_back(i)
27 exld = ROOT.std.vector('double')()
28 for i in [.0,.0,.0,.0,.0,.0,.0,.0,.0,.0]: exld.push_back(i)
29 eyld = ROOT.std.vector('double')()
30 for i in [.0,.0,.05,.0,.0,.0,.0,.0,.0,.0]: eyld.push_back(i)
31 exhd = ROOT.std.vector('double')()
32 for i in [.0,.0,.0,.0,.0,.0,.0,.0,.0,.0]: exhd.push_back(i)
33 eyhd = ROOT.std.vector('double')()
34 for i in [.0,.0,.0,.0,.0,.0,.0,.0,.05,.0]: eyhd.push_back(i)
35 
36 gr = 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 
39 gr.SetTitle("TGraphBentErrors Example")
40 gr.SetMarkerColor(4)
41 gr.SetMarkerStyle(21)
42 gr.Draw("ALP")