TH1F axis labels too long!


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.


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


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


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

Cheers, Matt