Re: [ROOT] Histo y-limits

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Oct 04 2001 - 10:19:31 MEST


Hi Robert,

In a macro, you must call TCanvas::Update(). See the explanations in:
  
    http://root.cern.ch/root/HowtoDraw.html

Here is a small example:

{
  TCanvas *c1 = new TCanvas("c1","c1",10,10,500,800);
  TH1F h("h","test",100,-4,4);
  h.FillRandom("gaus",10000);
  c1->Divide(1,3);
  c1->cd(3);
  h->Draw();
  c1->Update();
 
printf("PadLow=%g,                                                                   
PadHigh=%g\n",gPad->GetFrame()->GetY1(),gPad->GetFrame()->GetY2());
  printf("PadLow=%g, PadHigh=%g\n",gPad->GetUymin(),gPad->GetUymax());

}

Rene Brun


}Robert Zitoun wrote:
> 
>   I want know the y-limits of a histogram made automatically.
> 
> I get the values I want when I type interactively
> 
>   c1->cd(3);
>   h->Draw();
>   gPad->GetFrame()->GetY1();
>   gPad->GetFrame()->GetY2();
> 
> However, when I do it within a macro, I get Y1=0 and Y2=1;
> I suspect this is due to "gPad" which does not work as I think.
> So how do I get the y-limits.
> 
>          Robert



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:02 MET