Numbers in scientific format on the x-axis of 1D histogram

I want to make the numbers appearing the x-axis of my 1D histogram to appear in a scientific format, i.e. 0.0006 will look like 6x10^-4. I am using ROOT Version: 5.34/09. Is there any function in this version of this ROOT which will help me to display the numbers in x-axis in scientific format ?

Hi,
try to use SetMaxDigits, like this.

hist->GetXaxis()->SetMaxDigits(1);

Should work also in the ROOT old version.

Best,
Stefano

Getting an error like this,
AttributeError: ‘TAxis’ object has no attribute 'SetMaxDigits’

Try just

TGaxis::SetMaxDigits(1);

before drawing hist. Just note that this, as the Documentation says, changes the max number of digits in all axes.

Shouldn’t that set the precision for both the axes ?

With the version you are using SetMaxDigits was a global setting only (for all axis). The possibility to set it “per axis” appeared later.