Hi Emily, If it's just the size of the stats box you would like to change then you can put things like: gStyle->SetOptStat(1111111); // Set stat options gStyle->SetStatY(0.9); // Set y-position (fraction of pad size) gStyle->SetStatX(0.9); // Set x-position (fraction of pad size) gStyle->SetStatW(0.4); // Set width of stat-box (fraction of pad size) gStyle->SetStatH(0.2); // Set height of stat-box (fraction of pad size) in your script cheers, Simon eg... ===========/ yourscript.cpp /========================= { gStyle->SetStatY(0.9); gStyle->SetStatX(0.9); gStyle->SetStatW(0.4); gStyle->SetStatH(0.5); TFile f("example.root","READ"); TH1F *h = (TH1F*)gDirectory->Get("invmass_miss_dt")); h->Draw(); } ====================================================== On Tue, 20 Jan 2004, Emily Nurse wrote: > 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