Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
graphreverse.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_graphs
3/// \notebook
4/// This example test all the various case of reverse graphs
5/// combined with logarithmic scale..
6///
7/// \macro_image
8/// \macro_code
9///
10/// \author Olivier Couet
11
12void graphreverse() {
13 auto c = new TCanvas("c","Reversed graphs",0,0,900,900);
14 c->Divide(3,3);
15
16 // TGraphErrors
17 auto graphe = new TGraphErrors();
18 graphe->GetXaxis()->SetNdivisions(514);
19 graphe->GetYaxis()->SetNdivisions(514);
20 graphe->SetMarkerStyle(kCircle);
21 graphe->SetPoint(0,5,5);
22 graphe->SetPointError(0,1,3);
23 graphe->SetPoint(1,9,9);
24 graphe->SetPointError(1,1,3);
25
26 c->cd(1);
27 gPad->SetGrid();
28 graphe->Draw("a pl ");
29
30 c->cd(2);
31 gPad->SetGrid();
32 graphe->Draw("a pl rx ry ");
33
34 c->cd(3);
35 gPad->SetGrid();
36 gPad->SetLogx();
37 gPad->SetLogy();
38 graphe->GetXaxis()->SetMoreLogLabels();
39 graphe->GetYaxis()->SetMoreLogLabels();
40 graphe->Draw("a pl rx ry");
41
42 // TGraphAsymmErrors
43 auto graphae = new TGraphAsymmErrors();
44 graphae->GetXaxis()->SetNdivisions(514);
45 graphae->GetYaxis()->SetNdivisions(514);
46 graphae->SetMarkerStyle(kCircle);
47 graphae->SetPoint(0,5,5);
48 graphae->SetPointError(0,1,3,3,1);
49 graphae->SetPoint(1,9,9);
50 graphae->SetPointError(1,1,3,1,3);
51
52 c->cd(4);
53 gPad->SetGrid();
54 graphae->Draw("a pl ");
55
56 c->cd(5);
57 gPad->SetGrid();
58 graphae->Draw("a pl rx ry ");
59
60 c->cd(6);
61 gPad->SetGrid();
62 gPad->SetLogx();
63 gPad->SetLogy();
64 graphae->GetXaxis()->SetMoreLogLabels();
65 graphae->GetYaxis()->SetMoreLogLabels();
66 graphae->Draw("a pl rx ry");
67
68 // TGraphBentErrors
69 auto graphbe = new TGraphBentErrors();
70 graphbe->GetXaxis()->SetNdivisions(514);
71 graphbe->GetYaxis()->SetNdivisions(514);
72 graphbe->SetMarkerStyle(kCircle);
73 graphbe->SetPoint(0,5,5);
74 graphbe->SetPointError(0,1,3,3,1,.5,.2,.5,.2);
75 graphbe->SetPoint(1,9,9);
76 graphbe->SetPointError(1,1,3,1,3,-.5,-.2,-.5,-.2);
77
78 c->cd(7);
79 gPad->SetGrid();
80 graphbe->Draw("a pl ");
81
82 c->cd(8);
83 gPad->SetGrid();
84 graphbe->Draw("a pl rx ry ");
85
86 c->cd(9);
87 gPad->SetGrid();
88 gPad->SetLogx();
89 gPad->SetLogy();
90 graphbe->GetXaxis()->SetMoreLogLabels();
91 graphbe->GetYaxis()->SetMoreLogLabels();
92 graphbe->Draw("a pl rx ry");
93}
#define c(i)
Definition RSha256.hxx:101
@ kCircle
Definition TAttMarker.h:53
#define gPad
The Canvas class.
Definition TCanvas.h:23
TGraph with asymmetric error bars.
A TGraphBentErrors is a TGraph with bent, asymmetric error bars.
A TGraphErrors is a TGraph with error bars.