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

From: matej batic (matej.batic1@guest.arnes.si)
Date: Thu Feb 19 2004 - 17:36:28 MET






  
  


Thanks. The problem actually was that canvas was not updated yet and
there was nothing like "stats" at the point where I called it.

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



  


-- 
----
   Matej Batic
-----------------
You can take all the impact that science considerations have on funding
decisions at NASA, put them in the navel of a flea, and have room left
over for a caraway seed and Tony Calio's heart.
		-- F. Allen



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