TH1F axis labels too long!

Hi,

I have a TH1F histogram with a large number of entries. Unfortunately the axis labels are starting to interfere with my axis title so i’d like a simple way to remove 3 zero’s from each label and add a x10^3 to the axis (for example). Obviously i can divide the contents of each bin by 1000 and add the x10^3 manually, but I’m thinking there must be a tidier way!

Any suggestions?

Thanks, Matt

Hi Matt,

Try TGaxis::SetMaxDigits(2);

Note that this is a global parameter. You may have to reset it for other histograms.

Bertrand.

You can also act on various axis parameters (h is an histogram):

   h->GetYaxis()->SetLabelOffset(0.002);
   h->GetYaxis()->SetLabelSize(0.03);
   h->GetYaxis()->SetTitleOffset(1.05);

And also change the left margin to make more room (c is a canvas):

   c->SetLeftMargin(0.2514368);

Thanks for your feedback. I think TGaxis::SetMaxDigits(2) should solve my problem exactly.

Cheers, Matt