Minimal working example:
// Create a canvas and something to draw on it.
TCanvas *c1=new TCanvas(“c1”);
TH1D h(“h”,"",1,0,100);
h.Draw();
c1->Update();
TGaxis::SetMaxDigits(2); // try this
TPad apad=(TPad)c1->GetPad(0);
// Create another axis to draw on the right side of the pad.
TGaxis axis(apad->GetUxmax(),apad->GetUymin(),apad->GetUxmax(),apad->GetUymax(),0,1e-3);
TGaxis::SetMaxDigits(2); // try again
axis.SetMaxDigits(2); // this shouldn’t be necessary
axis.Draw();
Result is only the histogram axis are affected by fgMaxDigits; not the TGaxis!