ROOT
Version master
master
v6.34
v6.32
v6.30
v6.28
v6.26
v6.24
v6.22
v6.20
v6.18
v6.16
v6.14
v6.12
v6.10
v6.08
v6.06
v6.04
Reference Guide
►
ROOT
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
gr004_errors_asym.C
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
12
13
void
gr004_errors_asym
() {
14
TCanvas
*
c2
=
new
TCanvas
(
"c2"
,
""
, 700, 500);
15
16
c2
->SetGrid();
17
const
Int_t
npoints
=3;
18
Double_t
xaxis
[
npoints
] = {1.,2.,3.};
19
Double_t
yaxis
[
npoints
] = {10.,20.,30.};
20
21
Double_t
exl
[
npoints
] = {0.5,0.2,0.1};
//Lower x errors
22
Double_t
exh
[
npoints
] = {0.5,0.3,0.4};
//Higher x errors
23
Double_t
eyl
[
npoints
] = {3.,5.,4.};
//Lower y errors
24
Double_t
eyh
[
npoints
] = {3.,5.,4.};
//Higher y errors
25
26
TGraphAsymmErrors
*
gr
=
new
TGraphAsymmErrors
(
npoints
,
xaxis
,
yaxis
,
exl
,
exh
,
eyl
,
eyh
);
//Create the TGraphAsymmErrors object with data and asymmetrical errors
27
28
gr
->
SetTitle
(
"A simple graph with asymmetrical errors"
);
29
gr
->
Draw
(
"A*"
);
//"A" = draw axes and "*" = draw markers at the points with error bars
30
}
Int_t
int Int_t
Definition
RtypesCore.h:45
Double_t
double Double_t
Definition
RtypesCore.h:59
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TGraphAsymmErrors
TGraph with asymmetric error bars.
Definition
TGraphAsymmErrors.h:26
TGraph::Draw
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
Definition
TGraph.cxx:833
TGraph::SetTitle
void SetTitle(const char *title="") override
Change (i.e.
Definition
TGraph.cxx:2402
gr
TGraphErrors * gr
Definition
legend1.C:25
c2
return c2
Definition
legend2.C:14
tutorials
visualisation
graphs
gr004_errors_asym.C
ROOT master - Reference Guide Generated on Mon Feb 24 2025 14:45:13 (GVA Time) using Doxygen 1.10.0