Cannot get both stat boxes to show when using draw->(SAME)

ROOT Version: Not Sure I’m Sorry
Platform: Visual Studio Code C++
Compiler: Also not sure

I am using the ->Draw(“SAME”) command for two histograms on the same canvas and I cannot get the first stat box to show up, only the second. I’ve tried a ton of stuff and nothing is working, any help would be greatly appreciated.

TCanvas *c1 = new TCanvas();
    c1->Divide(4,4);
    for (int l=0; l<16; l++){
        c1->cd(l+1);
        nrpdrun374810[l]->SetMarkerColor(kRed);
        nrpdrun374810[l]->SetMarkerStyle(20);
        nrpdrun374810[l]->SetMarkerSize(0.5);
        nrpdrun375259[l]->SetMarkerColor(kBlue);
        nrpdrun375259[l]->SetMarkerStyle(20);
        nrpdrun375259[l]->SetMarkerSize(0.5);

        nrpdrun375259[l]->Draw("P");
        nrpdrun374810[l]->Draw("SAME P");
        legend[l]->Draw("");
    }

c1->Update();
___```

Hi,

to make both stat boxes to appear, you need to draw the second histogram with the “SAMES” (or “sames”) option, but not “SAME” (or "same"). But even then the first stat box will be “behind” the second one, so you will have to move them around yourself.

See: ROOT: tutorials/hist/transpad.C File Reference

that worked, thank you so much I had been stuck on that for days

1 Like