Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
gaxis2.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_graphics
3/// \notebook
4/// Example illustrating how to draw TGaxis with labels defined by a function.
5///
6/// \macro_image
7/// \macro_code
8///
9/// \author Olivier Couet
10
11void gaxis2(){
13
14 TH2F *h2 = new TH2F("h","Axes",100,0,10,100,-2,2);
15 h2->Draw();
16
17 TF1 *f1 = new TF1("f1","-x",-10,10);
18 TGaxis *A1 = new TGaxis(0,2,10,2,"f1",510,"-");
19 A1->SetTitle("axis with decreasing values");
20 A1->Draw();
21
22 TF1 *f2 = new TF1("f2","exp(x)",0,2);
23 TGaxis *A2 = new TGaxis(1,1,9,1,"f2");
24 A2->SetTitle("exponential axis");
25 A2->SetLabelSize(0.03);
26 A2->SetTitleSize(0.03);
27 A2->SetTitleOffset(1.2);
28 A2->Draw();
29
30 TF1 *f3 = new TF1("f3","log10(x)",1,1000);
31 TGaxis *A3 = new TGaxis(2,-2,2,0,"f3",505,"G");
32 A3->SetTitle("logarithmic axis");
33 A3->SetLabelSize(0.03);
34 A3->SetTitleSize(0.03);
35 A3->SetTitleOffset(1.2);
36 A3->Draw();
37}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TStyle * gStyle
Definition TStyle.h:436
1-Dim function class
Definition TF1.h:233
The axis painter class.
Definition TGaxis.h:24
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:307
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:1640
TF1 * f1
Definition legend1.C:11