ROOT logo

From $ROOTSYS/tutorials/graphics/gaxis2.C

//Example illustrating how to draw TGaxis with labels defined by a function.
//Author: Olivier Couet
{
   gStyle->SetOptStat(0);

   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();
}
 gaxis2.C:1
 gaxis2.C:2
 gaxis2.C:3
 gaxis2.C:4
 gaxis2.C:5
 gaxis2.C:6
 gaxis2.C:7
 gaxis2.C:8
 gaxis2.C:9
 gaxis2.C:10
 gaxis2.C:11
 gaxis2.C:12
 gaxis2.C:13
 gaxis2.C:14
 gaxis2.C:15
 gaxis2.C:16
 gaxis2.C:17
 gaxis2.C:18
 gaxis2.C:19
 gaxis2.C:20
 gaxis2.C:21
 gaxis2.C:22
 gaxis2.C:23
 gaxis2.C:24
 gaxis2.C:25
 gaxis2.C:26
 gaxis2.C:27
 gaxis2.C:28
 gaxis2.C:29
 gaxis2.C:30