Hiding the "10^N" of axis in ratio pad

In the attached “ratiobrun2.C” (based on tutorial macro) there’s a plot with a main pad and a “ratio pad”. In the ratio pad, the “10^N” of the y axis is hidden behind the main pad. Could someone explain how this works? It seems weird to me that the axis wouldn’t be plotted on top of the main pad as the histogram is drawn after the main pad is drawn.

In fact this behaviour is something I want to achieve in another macro, but cannot even though I believe I’m doing the same thing (instead it’s printed on top of the main pad in the bottom left corner in an ugly way).
ratiobrun2.C (1.85 KB)

One possible way:

{
    TGaxis::SetMaxDigits(2);
    TH1F *h1 = new TH1F("h1","test1",100,-3,3);
    h1->FillRandom("gaus",9000000);
    h1->GetXaxis()->SetLabelFont(63); //font in pixels
    h1->GetXaxis()->SetLabelSize(16); //in pixels
    h1->GetYaxis()->SetLabelFont(63); //font in pixels
    h1->GetYaxis()->SetLabelSize(16); //in pixels
    TH1F *h2 = new TH1F("h2","test2",100,-3,3);
    h2->FillRandom("gaus",500);
    TCanvas *c1 = new TCanvas("c1","example",600,700);
    TPad *pad1 = new TPad("pad1","pad1",0,0.3,1,1);
    pad1->SetBottomMargin(0.01);
    pad1->Draw();
    pad1->cd();
    TH1F* h3 = (TH1F*)h1->DrawCopy();
    h2->Draw("same");
    c1->cd();

    TPad *pad2 = new TPad("pad2","pad2",0,0,1,0.3);
    pad2->Draw();
    pad2->cd();
    h1->Sumw2();
    h1->SetStats(0);
    h1->Divide(h2);
    h1->SetMarkerStyle(21);
    h1->Draw("ep");
    h1->SetTitle("");

    //c1->cd();
}