Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
gr004_errors_asym.C File Reference

Detailed Description

View in nbviewer Open in SWAN
This tutorial demonstrates the use of TGraphAsymmErrors to plot a graph with asymmetrical errors on both the x and y axes.

The errors for the x values are divided into low (left side of the marker) and high (right side of the marker) errors. Similarly, for the y values, there are low (lower side of the marker) and high (upper side of the marker) errors.

TCanvas *c2 = new TCanvas("c2","", 700, 500);
c2->SetGrid();
const Int_t npoints=3;
Double_t xaxis[npoints] = {1.,2.,3.};
Double_t yaxis[npoints] = {10.,20.,30.};
Double_t exl[npoints] = {0.5,0.2,0.1}; //Lower x errors
Double_t exh[npoints] = {0.5,0.3,0.4}; //Higher x errors
Double_t eyl[npoints] = {3.,5.,4.}; //Lower y errors
Double_t eyh[npoints] = {3.,5.,4.}; //Higher y errors
TGraphAsymmErrors *gr = new TGraphAsymmErrors(npoints,xaxis,yaxis,exl,exh,eyl,eyh); //Create the TGraphAsymmErrors object with data and asymmetrical errors
gr->SetTitle("A simple graph with asymmetrical errors");
gr->Draw("A*"); //"A" = draw axes and "*" = draw markers at the points with error bars
}
int Int_t
Definition RtypesCore.h:45
double Double_t
Definition RtypesCore.h:59
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
The Canvas class.
Definition TCanvas.h:23
TGraph with 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
TGraphErrors * gr
Definition legend1.C:25
return c2
Definition legend2.C:14
Author
Miro Helbich

Definition in file gr004_errors_asym.C.