Set number of digits

Dears rooters,

How can I set the number of digits? I know that there is a command TGaxis.SetMaxDigits(2), but this set the number of diigt for both axis, instead I need to set a different digits for the 2 axis.

Thanks in advance :slight_smile:

This setting is global for all axis. It is not a “per axis” …
When this was design the developers thought it was a global setting.

So there is no possibility to set the digits for only 1 axis?

No, TGaxis.SetMaxDigits() is a global setting.

See also
TGaxis::SetMaxDigits → (7 years in the todo list… vote up to work on that :wink:
Setting max digits per TAxis
Maximum number of digits in axis label

Could be implemented as with ExponentOffset:

The problem is that TAxis a a very low level class … each histogram has 2. 2 additional data members might have a great impact on root file size. That’s why it was decided to have global settings and also why these settings were not converted into local settings until now.

But why not using global static variables gMaxDigitsX, gMaxDigitsY, gMaxDigitsZ that are not stored in the TFile? Just for plotting purposes.

This has been done with the exponential offset already. See:

TGaxis::SetExponentOffset(-0.01, 0.01, "y"); // X and Y offset for Y axis TGaxis::SetExponentOffset(-0.05, 0.01, "x"); // Y and Y offset for X axis

Yes, this we can do.