ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
gaxis.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_graphics
3 /// Simple example illustrating how to draw TGaxis objects in various formats.
4 ///
5 /// \macro_image
6 /// \macro_code
7 ///
8 /// \author Rene Brun
9 
10 void gaxis(){
11  TCanvas *c1 = new TCanvas("c1","Examples of TGaxis",10,10,700,500);
12 
13  c1->Range(-10,-1,10,1);
14 
15  TGaxis *axis1 = new TGaxis(-4.5,-0.2,5.5,-0.2,-6,8,510,"");
16  axis1->SetName("axis1");
17  axis1->Draw();
18 
19  TGaxis *axis2 = new TGaxis(-4.5,0.2,5.5,0.2,0.001,10000,510,"G");
20  axis2->SetName("axis2");
21  axis2->Draw();
22 
23  TGaxis *axis3 = new TGaxis(-9,-0.8,-9,0.8,-8,8,50510,"");
24  axis3->SetName("axis3");
25  axis3->SetTitle("axis3");
26  axis3->SetTitleOffset(0.5);
27  axis3->Draw();
28 
29  TGaxis *axis4 = new TGaxis(-7,-0.8,-7,0.8,1,10000,50510,"G");
30  axis4->SetName("axis4");
31  axis4->SetTitle("axis4");
32  axis4->Draw();
33 
34  TGaxis *axis5 = new TGaxis(-4.5,-0.6,5.5,-0.6,1.2,1.32,80506,"-+");
35  axis5->SetName("axis5");
36  axis5->SetLabelSize(0.03);
37  axis5->SetTextFont(72);
38 
39  axis5->Draw();
40 
41  TGaxis *axis6 = new TGaxis(-4.5,0.5,5.5,0.5,100,900,50510,"-");
42  axis6->SetName("axis6");
43  axis6->Draw();
44  TGaxis *axis6a = new TGaxis(-5.5,0.85,5.5,0.85,0,4.3e-6,510,"");
45  axis6a->SetName("axis6a");
46  axis6a->Draw();
47 
48  TGaxis *axis7 = new TGaxis(8,-0.8,8,0.8,0,9000,50510,"+L");
49  axis7->SetName("axis7");
50  axis7->Draw();
51 
52  //one can make axis going top->bottom. However because of a long standing
53  //problem, the two x values should not be equal
54  TGaxis *axis8 = new TGaxis(6.5,0.8,6.499,-0.8,0,90,50510,"-");
55  axis8->SetName("axis8");
56  axis8->Draw();
57 }
virtual void SetName(const char *name)
Change the name of the axis.
Definition: TGaxis.cxx:2242
virtual void SetTitle(const char *title="")
Change the title of the axis.
Definition: TGaxis.cxx:2280
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:254
virtual void SetTextFont(Font_t tfont=62)
Definition: TAttText.h:59
void SetLabelSize(Float_t labelsize)
Definition: TGaxis.h:118
virtual void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Set world coordinate system for the pad.
Definition: TPad.cxx:4623
The axis painter class.
Definition: TGaxis.h:39
The Canvas class.
Definition: TCanvas.h:48
void SetTitleOffset(Float_t titleoffset=1)
Definition: TGaxis.h:131