Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
gr009_bent_err.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_graphs
3/// \notebook -js
4/// \preview Graph with bent error bars. See the [TGraphBentErrors documentation](https://root.cern/doc/master/classTGraphBentErrors.html)
5///
6/// exl / exh: low and high (left/right) errors in x; similar for y
7/// e*d: delta, in axis units, to be added/subtracted (if >0 or <0) in x or y from
8/// the data point's position to use as end point of the corresponding error
9///
10/// \macro_image
11/// \macro_code
12/// \author Olivier Couet
13
14void gr009_bent_err()
15{
16 const Int_t n = 10;
17 Double_t x[n] = {-0.22, 0.05, 0.25, 0.35, 0.5, 0.61,0.7,0.85,0.89,0.95};
18 Double_t y[n] = {1,2.9,5.6,7.4,9,9.6,8.7,6.3,4.5,1};
19 Double_t exl[n] = {.05,.1,.07,.07,.04,.05,.06,.07,.08,.05};
20 Double_t eyl[n] = {.8,.7,.6,.5,.4,.4,.5,.6,.7,.8};
21 Double_t exh[n] = {.02,.08,.05,.05,.03,.03,.04,.05,.06,.03};
22 Double_t eyh[n] = {.6,.5,.4,.3,.2,.2,.3,.4,.5,.6};
23 Double_t exld[n] = {.0,.0,.0,.0,.0,.0,.0,.0,.0,.0};
24 Double_t eyld[n] = {.0,.0,.05,.0,.0,.0,.0,.0,.0,.0};
25 Double_t exhd[n] = {.0,.0,.0,.0,.0,.0,.0,.0,.0,.0};
26 Double_t eyhd[n] = {.0,.0,.0,.0,.0,.0,.0,.0,.05,.0};
29 gr->SetTitle("TGraphBentErrors Example");
31 gr->SetMarkerStyle(21);
32 gr->Draw("ALP");
33}
int Int_t
Definition RtypesCore.h:45
double Double_t
Definition RtypesCore.h:59
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition TAttMarker.h:39
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition TAttMarker.h:41
A TGraphBentErrors is a TGraph with bent, asymmetric error bars.
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
Definition TGraph.cxx:833
void SetTitle(const char *title="") override
Change (i.e.
Definition TGraph.cxx:2402
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
TGraphErrors * gr
Definition legend1.C:25