Re: RE: [ROOTDEV] TPaveStats

From: Jiri Kvita <Jiri.Kvita_at_cern.ch>
Date: Mon, 21 Mar 2011 11:10:07 +0100


Hello!

BTW I find it interesting that one can crash ROOT by root -l
[] TPad a ; a.Update()

as there us no pointer protection o fCanvas in the Update()

With regards,

Jiri

Olivier Couet wrote:
> 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!
>

-- 
------------------------------------------------------------------------
   Office: 40-3D-06, Tel. (+41 2276) 73436, Cell +41 76 239 5696
    Jiri.Kvita@cern.ch, A1 Rh+,  http://qitek.web.cern.ch/qitek/
------------------------------------------------------------------------
Received on Mon Mar 21 2011 - 11:10:12 CET

This archive was generated by hypermail 2.2.0 : Mon Mar 21 2011 - 11:50:02 CET