Label on log axis

From: lijowski@cosray2.wustl.edu
Date: Wed Apr 28 1999 - 20:06:52 MEST


  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