Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
gaxis.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_graphics
3/// \notebook
4/// Simple example illustrating how to draw TGaxis objects in various formats.
5///
6/// \macro_image
7/// \macro_code
8///
9/// \authors Rene Brun, Olivier Couet
10
11void gaxis()
12{
13 auto c1 = new TCanvas("c1","Examples of TGaxis",10,10,700,500);
14 c1->Range(-10,-1,10,1);
15
16 auto axis1 = new TGaxis(-4.5,-0.2,5.5,-0.2,-6,8,510,"");
17 axis1->Draw();
18
19 auto axis2 = new TGaxis(-4.5,0.2,5.5,0.2,0.001,10000,510,"G");
20 axis2->Draw();
21
22 auto axis3 = new TGaxis(-9,-0.8,-9,0.8,-8,8,50510,"");
23 axis3->SetTitle("axis3");
24 axis3->SetTitleOffset(0.5);
25 axis3->Draw();
26
27 auto axis4 = new TGaxis(-7,-0.8,-7,0.8,1,10000,50510,"G");
28 axis4->SetTitle("axis4");
29 axis4->Draw();
30
31 auto axis5 = new TGaxis(-4.5,-0.6,5.5,-0.6,1.2,1.32,80506,"-+");
32 axis5->SetLabelSize(0.03);
33 axis5->SetTextFont(72);
34 axis5->Draw();
35
36 auto axis6 = new TGaxis(-4.5,0.5,5.5,0.5,100,900,50510,"-");
37 axis6->Draw();
38
39 auto axis7 = new TGaxis(-5.5,0.85,5.5,0.85,0,4.3e-6,510,"");
40 axis7->Draw();
41
42 auto axis8 = new TGaxis(8,-0.8,8,0.8,0,9000,50510,"+L");
43 axis8->Draw();
44
45 // One can make a vertical axis going top->bottom.
46 // However one need to adjust labels align to avoid overlapping.
47 auto axis9 = new TGaxis(6.5,0.8,6.5,-0.8,0,90,50510,"-L");
48 axis9->Draw();
49}
The Canvas class.
Definition TCanvas.h:23
The axis painter class.
Definition TGaxis.h:24
return c1
Definition legend1.C:41