Cannot force desired divisions using SetNdivisions

From: Paul Miyagawa <Paul.Miyagawa_at_cern.ch>
Date: Sat, 10 Sep 2011 17:01:04 +0000


Hello,

I am trying to draw a histogram with the x-axis as log Energy ranging from 1e-15 MeV to 1e6 MeV (i.e., -15 to +6). I would like to have primary tick marks every 3 decades and secondary tick marks every decade. If I have calculated properly, I should SetNdivisions(307). However, no matter what I try I cannot force this; Root plots as if SetNdivisions(210). The following macro is a distillation of what I do:

{
  TH1F *mhereg = new TH1F( "loge", "log Energy [MeV]", 210, -15, 6 );   mhereg->SetNdivisions( -307 );
  TAxis *xhereg = mhereg->GetXaxis();
  for (int i=-15; i<6; i+=3) {
    char blabel[100];
    sprintf( blabel, "10^{%d}", i );
    xhereg->SetBinLabel( 1+10*(i+15), blabel );     mhereg->Fill(i);
  }
  mhereg->Draw();
}

I have tried many variations of SetNdivisions, including:

xhereg->SetNdivisions( -307 );
xhereg->SetNdivisions( 307, kFALSE );
xhereg->SetNdivisions( 7, 3, 0, kFALSE );

How can I force Root to give what I want? Thanks for any help.

Cheers,
Paul

c1.gif
Received on Sat Sep 10 2011 - 19:01:11 CEST

This archive was generated by hypermail 2.2.0 : Sat Sep 10 2011 - 23:50:01 CEST