[ROOT] Re: TPaveStats follow-up question.

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Nov 21 2003 - 19:14:14 MET


Bernard,

Bernard Andrieu wrote:
> 
> Hi Rene,
> 
> Rene Brun a écrit :
> 
> Of course, I agree that it makes sense only when associated with a histogram,
> but why does it make sense ONLY when the histogram has been ALREADY DRAWN? If I
> do:
> 
> TPaveStats *st = (TPaveStats*)h->GetListOfFunctions()->FindObject("stats");
> st->SetX1NDC(0.6) ; st->SetX2NDC(0.9) ; st->SetY1NDC(0.6) ; st->SetY2NDC(0.9);
> 
> BEFORE h->Draw(), then I get the "Error: illegal pointer.." message.

Of course, you get a null pointer. As I said, the 'stats" box is created
when the histogram is Paint in the canvas, not when you Draw.
Do you understand the difference between the two?

> >
> I don't understand what you don't understand, but OK let me explain it in
> another way:
> 
> I want to produce a plot of an histogram with a particular position of the stat
> box. It seems to me (please correct me if I'm wrong) that I need to draw the
> histogram a first (and, to me, useless) time, just to be able to use the
> TPaveStats. Then, once I have defined the position of the stat box, I have to
> redraw the histogram a secund time to have it displayed as I wish.
> 
No, you only need to redraw the histogram in case your change your mind
about the TPaveStats position after having Drawn the histogram.
Use the TStyle methods to set a different standard position if you are happy
with the default behaviour.

> Is it bound to be so?
> 
> I also tried to use the  TStyle::SetStatH,X,Y,W as you suggest. This answers
> partly to my question, but it is not as convenient as TPaveStats in multi-pad
> environment, because the values used in SetStatH and SetStatW are scaled to the
> size of the canvas, not to the size of the subpad.

NO. these methods set positions/sizes in the pad, not the canvas.

Rene Brun

> --
>                       Best regards,
>                                Bernard Andrieu
> -----------------------------------------------------------------------
>                          ("-/")_.-'"-._
> LPNHE, 4 pl. Jussieu      . . ; -._    )-;-,_)  email: andrieu@in2p3.fr
>     Tour 33, RdC         (v_,)'  _  )-.\  -'    Tel: +33 (0)1 4427 2321
> 75252 PARIS CEDEX 05    _.- _..-_/ / ((.'       Fax: +33 (0)1 4427 4638
>                       ((,.-'   ((,/
> -----------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:17 MET