Re: [ROOT] Changing the position of the statistics box

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Feb 19 2004 - 16:25:55 MET


Hi Matej,

See the doc of THistPainter::Paint. It says:

// When the histogram is drawn, a TPaveStats object is created and added
// to the list of functions of the histogram. If a TPaveStats object already
// exists in the histogram list of functions, the existing object is just
// updated with the current histogram parameters.
// With the option "same", the statistic box is not redrawn.
// With the option "sames", the statistic box is drawn. If it hiddes
// the previous statistics box, you can change its position
// with these lines (if h is the pointer to the histogram):
//
//  Root > TPaveStats *st =
(TPaveStats*)h->GetListOfFunctions()->FindObject("stats")
//  Root > st->SetX1NDC(newx1); //new x start position
//  Root > st->SetX2NDC(newx2); //new x end position
//
// To change the type of information for an histogram with an existing
TPaveStats
// you should do: st->SetOptStat(mode) where mode has the same meaning than
// when calling gStyle->SetOptStat(mode) (see above).

This feature was documented in the Relaese Notes.

Rene Brun

matej batic wrote:
> 
> Using
>   TPaveStats *s = (TPaveStats*) gPad->GetPrimitive("stats");
>   s->SetX1NDC(0.5);
>   s->SetY1NDC(0.5);
>   ...
> I get
> Error: illegal pointer to class object s 0x0 227
> *** Interpreter error recovered ***
> 
> I am using ROOT v 3.10/02 with gcc3.3.2 on RH
> 
> Do you have any ideas?
> 
> --
> ----
>    Matej Batic
> -----------------



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET