Re: Label on log axis

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat May 01 1999 - 15:26:40 MEST


Hi Michal,
Your combination of canvas size and axis range give
effectively bad results. The Root axis algorithm must be
improved. I will look into this problem.
Meanwhile, I suggest you play a bit with both the
label offset and the label size as shown in your macro
with a few mods (indicated with //***)
   
Rene Brun
   
   
{
   gROOT -> Reset();
   TCanvas *cc1 = new TCanvas("cc1", "My Canvas", 800, 600);//***
   gStyle -> SetTitleX(0.22);
   gStyle -> SetTitleY(0.97);

   gPad -> SetBottomMargin(0.15);
   gPad -> SetLeftMargin(0.15);
   gPad -> SetTicks();
   gPad -> SetLogx();
   gPad -> SetLogy();

// define plot ranges with histogram class

  Float_t  xxmin =  50;
  Float_t  xxmax = 999.0;//***
  Float_t  yymin = 1.0E-9;
  Float_t  yymax = 2.0E-6;

  h2r = new TH2F("h2r", "Axis test", 2, xxmin, xxmax, 2, yymin, yymax);
  Float_t labelSize = 0.025;
  h2r -> GetXaxis() -> SetLabelOffset(-0.01);//***
  h2r -> GetXaxis() -> SetLabelSize(labelSize);//***
  h2r -> GetYaxis() -> SetLabelSize(labelSize);//***
  h2r -> Draw();
}




On 28 Apr 1999 lijowski@cosray2.wustl.edu wrote:

> 
>   Hello,
> 
>   I cannot figure how to get nice labels on X axis on the plots
>   generated by the attached macro. 
>   If I set Ndiv to 1 or -1 I get a single major tickmark at 100, 
>   a single tickmark at 500, and label at 500 and 1000. 
>   Any other value produces the same number of major and minor tickmarks
>   and overlapping labels. I have been using ROOT 2.21/08.
> 
>    Regards,
> 
>    Michal Lijowski
> 
> {
>    gROOT -> Reset();
>    TCanvas *cc1 = new TCanvas("cc1", "My Canvas", 600, 800);
>    gStyle -> SetTitleX(0.22);
>    gStyle -> SetTitleY(0.97);
> 
>    gPad -> SetBottomMargin(0.15);
>    gPad -> SetLeftMargin(0.15);
>    gPad -> SetTicks();
>    gPad -> SetLogx();
>    gPad -> SetLogy();
> 
> // define plot ranges with histogram class
> 
>   Float_t  xxmin =   50.0;
>   Float_t  xxmax = 1000.0;
>   Float_t  yymin = 1.0E-9;
>   Float_t  yymax = 2.0E-6;
> 
>   h2r = new TH2F("h2r", "Axis test", 2, xxmin, xxmax, 2, yymin, yymax);
>   printf(" NDiv %d\n", h2r -> GetXaxis() -> GetNdivisions());
>   h2r -> GetXaxis() -> SetNdivisions(-1);
>   printf(" NDiv %d\n", h2r -> GetXaxis() -> GetNdivisions());
>   h2r -> Draw();
>   cc1 -> Update();
> }
> 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:32 MET