Hi, all.

I need to set max digits to different numbers for the x-axis and y-axis in a histogram. We really want to keep 4 digits on the x-axis but only three on the y-axis due to overlap with the y-axis label.

As I understand it, there’s no straightforward way to set these separately, in that fgMaxDigits is a global variable that dictates the maximum digits for all axes at the same time.

Does anybody have a suggestion for how to accomplish this without too much gymnastics?

Thanks in advance.

As you noticed TGaxis::SetMaxDigits is a global setting. It cannot be done on individual axis.
Right now you cannot avoid the “gymnastics”. We had some plan to have this setting for each individual axis. It is in the to-do list but we have not done it yet.

Note that the Jira report related to this request is ROOT-35.

One could probably use TExec.
It allows to change global settings in-between of two paint calls.

  TExec ex1("ex1","TGaxis::SetMaxDigits(10);");
   // draw histograms which should have 10 digits on axis
   // and now restore global settings
   TExec ex2("ex2","TGaxis::SetMaxDigits();");

Not very nice solution, but should work