Hi Rene, When I try and use a macro { TFile f("example.root","READ"); h = (TH1F*)gDirectory->Get("invmass_miss_dt"); h->Draw(); TPaveStats *st=(TPaveStats*)h->GetListOfFunctions()->FindObject("stats"); st->SetX1NDC(0.); } I get the error: Error: illegal pointer to class object st 0x0 431 FILE:example.C LINE:6 *** Interpreter error recovered *** This is because TList *list=(TPaveStats*)h->GetListOfFunctions(); returns a null pointer. If I do exactly the same commands on the command line it works fine. How can I get round this problem? Cheers, Emily. On Mon, 19 Jan 2004, Rene Brun wrote: > Hi emily, > > This is explained in: > http://root.cern.ch/root/htmldoc/THistPainter.html#THistPainter:Paint > > look at section "Statistics Display" > > 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). > > Rene Brun > > Emily Nurse wrote: > > > > Hi all, > > Can someone tell me how I can change the size of my stats box for my > > histogramme (without using the interactive interface). > > Cheers, > > Emily. >
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET