Logo ROOT  
Reference Guide
gaxis2.C File Reference

Detailed Description

View in nbviewer Open in SWAN Example illustrating how to draw TGaxis with labels defined by a function.

void gaxis2(){
TH2F *h2 = new TH2F("h","Axes",100,0,10,100,-2,2);
h2->Draw();
TF1 *f1 = new TF1("f1","-x",-10,10);
TGaxis *A1 = new TGaxis(0,2,10,2,"f1",510,"-");
A1->SetTitle("axis with decreasing values");
A1->Draw();
TF1 *f2 = new TF1("f2","exp(x)",0,2);
TGaxis *A2 = new TGaxis(1,1,9,1,"f2");
A2->SetTitle("exponential axis");
A2->SetLabelSize(0.03);
A2->SetTitleSize(0.03);
A2->SetTitleOffset(1.2);
A2->Draw();
TF1 *f3 = new TF1("f3","log10(x)",1,1000);
TGaxis *A3 = new TGaxis(2,-2,2,0,"f3",505,"G");
A3->SetTitle("logarithmic axis");
A3->SetLabelSize(0.03);
A3->SetTitleSize(0.03);
A3->SetTitleOffset(1.2);
A3->Draw();
}
Author
Olivier Couet

Definition in file gaxis2.C.

TGaxis::SetTitleOffset
void SetTitleOffset(Float_t titleoffset=1)
Definition: TGaxis.h:124
TH2F
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:251
TGaxis::SetTitleSize
void SetTitleSize(Float_t titlesize)
Definition: TGaxis.h:125
gStyle
R__EXTERN TStyle * gStyle
Definition: TStyle.h:412
TGaxis::SetLabelSize
void SetLabelSize(Float_t labelsize)
Definition: TGaxis.h:107
TStyle::SetOptStat
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:1592
TGaxis::SetTitle
virtual void SetTitle(const char *title="")
Change the title of the axis.
Definition: TGaxis.cxx:2694
TObject::Draw
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:197
f1
TF1 * f1
Definition: legend1.C:11
TGaxis
Definition: TGaxis.h:23
TF1
1-Dim function class
Definition: TF1.h:212
TH1::Draw
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2997