Hi all,
How do I get TPaveStats for a histogram without drawing it to a new canvas and getting “stats” from the list of functions?
I’d like to draw 2 histos on the same pad and draw both TPaveStats. Furthermore, the way I’m doing things, only after pad update (meaning: after really draing the histo) does the pavestats becomes available (probably is created in this step) in the list of functions.
My workaround solution for now is:
c->cd(++cur_pad);
h->Draw();
gPad->Modified();
gPad->Update();
TPaveStats* hstat = (TPaveStats*)h->GetListOfFunctions()->FindObject("stats");
Double_t hstat_h = hstat->GetY2NDC() - hstat->GetY1NDC();
TCanvas* caux = new TCanvas("caux","caux");
hped->Draw();
gPad->Modified();
gPad->Update();
TPaveStats* hpedstat = (TPaveStats*)hped->GetListOfFunctions()->FindObject("stats");
hpedstat->SetY1NDC(hpedstat->GetY1NDC() - hstat_h - 0.05);
hpedstat->SetY2NDC(hpedstat->GetY2NDC() - hstat_h - 0.05);
c->cd(cur_pad);
hped->Draw("SAME");
hpedstat->Draw();
gPad->Modified();
gPad->Update();
Since drawing is very time consuming, I’d like to know if there is an easy cleaner way to draw n histos and their respective pavestats in one window.
Muchas gracias (thanks all),
Rui