Cannot set MaxDigits for additional TGaxis drawn on Pad

Minimal working example:
// Create a canvas and something to draw on it.
TCanvas *c1=new TCanvas(“c1”);
TH1D h(“h”,"",1,0,100);

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

Result is only the histogram axis are affected by fgMaxDigits; not the TGaxis!

Yes, it is coded that way. TGaxis::SetMaxDigits(); acts only on TGaxis axis produced from a TAxis, like in the histograms, not on the TGaxis alone.

To accomplish this I eventually discovered that the following:


using the same objects as defined in the original.