ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
gaxis2.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_graphics
3 /// Example illustrating how to draw TGaxis with labels defined by a function.
4 ///
5 /// \macro_image
6 /// \macro_code
7 ///
8 /// \author Olivier Couet
9 
10 void gaxis2(){
11  gStyle->SetOptStat(0);
12 
13  TH2F *h2 = new TH2F("h","Axes",100,0,10,100,-2,2);
14  h2->Draw();
15 
16  TF1 *f1 = new TF1("f1","-x",-10,10);
17  TGaxis *A1 = new TGaxis(0,2,10,2,"f1",510,"-");
18  A1->SetTitle("axis with decreasing values");
19  A1->Draw();
20 
21  TF1 *f2 = new TF1("f2","exp(x)",0,2);
22  TGaxis *A2 = new TGaxis(1,1,9,1,"f2");
23  A2->SetTitle("exponential axis");
24  A2->SetLabelSize(0.03);
25  A2->SetTitleSize(0.03);
26  A2->SetTitleOffset(1.2);
27  A2->Draw();
28 
29  TF1 *f3 = new TF1("f3","log10(x)",1,1000);
30  TGaxis *A3 = new TGaxis(2,-2,2,0,"f3",505,"G");
31  A3->SetTitle("logarithmic axis");
32  A3->SetLabelSize(0.03);
33  A3->SetTitleSize(0.03);
34  A3->SetTitleOffset(1.2);
35  A3->Draw();
36 }
R__EXTERN TStyle * gStyle
Definition: TStyle.h:423
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
void SetTitleSize(Float_t titlesize)
Definition: TGaxis.h:132
void SetLabelSize(Float_t labelsize)
Definition: TGaxis.h:118
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2878
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:256
The axis painter class.
Definition: TGaxis.h:39
1-Dim function class
Definition: TF1.h:149
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
Definition: TStyle.cxx:1252
void SetTitleOffset(Float_t titleoffset=1)
Definition: TGaxis.h:131