[ROOT] TPaveStats follow-up question.

From: Bernard Andrieu (andrieu@in2p3.fr)
Date: Fri Nov 21 2003 - 19:40:08 MET


Hi Rene,

Rene Brun a écrit :
> >
> > > >
> > > > Problem 2:
>  >
> > Although I don't understand the (presumably good) reasons behind these features
> > of the program, may I then suggest to add a new functionality that would allow
> > the TPaveStats... command to be executed WITHOUT the histogram being actually
> > drawn?
> 
> Not possible. The TPaveStats makes sense only when associated with a histogram.

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.

> Painting the 'stats" box is an action within the histogram painting function.
> And I cannot understand the rationale behind your request.
> 
See below.

> >
> > This is actually what I want to do, because, as you can imagine, I'm interested
> > in having the histogram displayed only when the position of the stat box has
> > been correctly defined.
> 
> Why? The position of the stats box is independent of the histogram coordinates
> and contents. Its position is expressed in NDC. You can use the TStyle
> functions to control the default position and size.
> see TStyle::SetStatH,X,Y,W.
> 
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.

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.
-- 
                      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