Stat box

i don’t know how to move the box with the stats to the left sido of my
histigram. I’m trying to make this:

TCanvas c1 = new TCanvas(“c1”,“delta_E y Mes B0T para el canal
1011”,2000,1600);
c1->Divide(2,1);
c1->cd(1);
delta_E_B0T_0->GetYaxis()->SetTitleOffset(1.30);
delta_E_B0T_0->Draw();//Histogram
c1->cd(2);
M_es_B0T_0->GetYaxis()->SetTitleOffset(1.30);
M_es_B0T_0->Draw();//Histogram that i’m trying to change

gPad->Update();
TPaveStats st = (TPaveStats)M_es_B0T_0->FindObject(“stats”);
st->SetX1NDC(5.21); //new x start position.
st->SetX2NDC(5.26); //new x end position
st->SetY1NDC(220); //new y start position
st->SetY2NDC(600); //new y end position
c1->Modified();
c1->Update();

*I want to move the stat box in the levels 5.21-5.26 in my X axis and 220-600
in my Y axis

And don’t works.

thank you

As explicitely indicated by the functions like SetX1NDC, one must set the
position in Normalized Devide Coordinates [0,1], not in user coordinates.
If you insist having user coordinates, you have to convert your points to NDC
with statements like

Double_t dpx = gPad->GetX2() - gPad->GetX1(); Double_t dpy = gPad->GetY2() - gPad->GetY1(); Double_t xp1 = gPad->GetX1(); Double_t yp1 = gPad->GetY1(); st->SetX1NDC((5.21-xp1)/dpx); //new x start position. st->SetX2NDC((5.26-yp1)/dpy); //new x end position st->SetY1NDC((220.-xp1)/dpx); //new y start position st->SetY2NDC((600.-yp1)/dpy); //new y end position Rene

It works!!! thank you

I couldn’t find the specific indications for those functions, i only could find examples. Where can i find the specific “things” that i must put in the functions and what do they do? I’m a beginner in Root and it’s a little difficult for me. Sorry about my English, is not well.

Thank you very much, twice

Hi,

Check the Reference’s guide at: root.cern.ch/root/html/ClassIndex.html

Cheers,
Philippe.