Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
gmultierrors.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_graphs
3/// \notebook -js
4/// Draw a graph with multiple y errors
5///
6/// \macro_image
7/// \macro_code
8///
9/// \author Simon Spies
10
11void gmultierrors() {
12 TCanvas *c1 = new TCanvas("c1", "A Simple Graph with multiple y-errors", 200, 10, 700, 500);
13 c1->SetGrid();
14 c1->GetFrame()->SetBorderSize(12);
15
16 const Int_t np = 5;
17 Double_t x[np] = {0, 1, 2, 3, 4};
18 Double_t y[np] = {0, 2, 4, 1, 3};
19 Double_t exl[np] = {0.3, 0.3, 0.3, 0.3, 0.3};
20 Double_t exh[np] = {0.3, 0.3, 0.3, 0.3, 0.3};
21 Double_t eylstat[np] = {1, 0.5, 1, 0.5, 1};
22 Double_t eyhstat[np] = {0.5, 1, 0.5, 1, 0.5};
23 Double_t eylsys[np] = {0.5, 0.4, 0.8, 0.3, 1.2};
24 Double_t eyhsys[np] = {0.6, 0.7, 0.6, 0.4, 0.8};
25
26 TGraphMultiErrors* gme = new TGraphMultiErrors("gme", "TGraphMultiErrors Example", np, x, y, exl, exh, eylstat, eyhstat);
27 gme->AddYError(np, eylsys, eyhsys);
28 gme->SetMarkerStyle(20);
29 gme->SetLineColor(kRed);
30 gme->GetAttLine(0)->SetLineColor(kRed);
31 gme->GetAttLine(1)->SetLineColor(kBlue);
32 gme->GetAttFill(1)->SetFillStyle(0);
33
34 // Graph and x erros drawn with "APS"
35 // Stat Errors drawn with "Z"
36 // Sys Errors drawn with "5 s=0.5"
37 gme->Draw("APS ; Z ; 5 s=0.5");
38
39 c1->Update();
40}
int Int_t
Definition RtypesCore.h:45
double Double_t
Definition RtypesCore.h:59
@ kRed
Definition Rtypes.h:66
@ kBlue
Definition Rtypes.h:66
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
The Canvas class.
Definition TCanvas.h:23
TGraph with asymmetric error bars and multiple y error dimensions.
Double_t y[n]
Definition legend1.C:17
return c1
Definition legend1.C:41
Double_t x[n]
Definition legend1.C:17