Re: RE: [ROOTDEV] TPaveStats

From: 陈晓辉 <xhchen_at_ihep.ac.cn>
Date: Mon, 21 Mar 2011 21:38:29 +0800


I appreciate your help very much, it works very well.

thank you!

-----原始邮件-----
发件人: "Olivier Couet" <Olivier.Couet_at_cern.ch> 发送时间: 2011年3月21日 星期一
收件人: "陈晓辉" <xhchen_at_ihep.ac.cn>, "rootdev_at_root.cern.ch" <rootdev_at_root.cern.ch>, "roottalk_at_root.cern.ch" <roottalk_at_root.cern.ch> 抄送:
主题: RE: [ROOTDEV] TPaveStats

Try this:  

{

TCanvas* c=new TCanvas();

TH1F* hist = new TH1F("hist", "hist", 100, -5, 5);

hist->FillRandom("gaus",10000);

hist->Draw();

hist->Fit("gaus", "", "", -3, 3);

gPad->Update();

TPaveStats *st =

(TPaveStats*)hist->GetListOfFunctions()->FindObject("stats");  

st->SetX1NDC(.2);

st->SetX2NDC(.4);

gPad->Update();

c->Modified();

}    

From:owner-rootdev_at_root.cern.ch [mailto:owner-rootdev_at_root.cern.ch] On Behalf Of ??? Sent: Monday, March 21, 2011 10:45 AM
To:rootdev_at_root.cern.ch; roottalk_at_root.cern.ch Subject: [ROOTDEV] TPaveStats  

Hi all,

i want to change the position of TPaveStats using codes as follows:

 TCanvas* c=new TCanvas();

    TH1F* hist = new TH1F("hist", "hist", 100, -5, 5);

    hist->FillRandom("gaus",10000);
    hist->Draw();
    hist->Fit("gaus", "", "", -3, 3);
    gPad->Update();

    TPaveStats *st = (TPaveStats*)hist->FindObject("stats");
    st->SetX1(2);
    st->SetY1(300);
    st->SetX2(4);
    st->SetY2(400);

    //st->UseCurrentStyle();
    gPad->Update();
    c->Modify();  

but nothing happens, could you please tell me how to set the position of TPaveStats

Thank you! Received on Mon Mar 21 2011 - 14:38:45 CET

This archive was generated by hypermail 2.2.0 : Mon Mar 21 2011 - 17:50:01 CET