Re: Stats box and Draw("same")

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Dec 17 1999 - 09:58:11 MET


Hi Anthony,
I have implemented a new option in TH1::Draw(option)
So far, when option "same" was specified, the function PaintStat was not
called.
If now you specify the option "sames", this function will be called.
I have added the following comments in the doc.

//
//  When option "same" is specified, the statistic box is not drawn.
//  Specify option "sames" to force painting statistics with option
"same"
//  When option "sames" is given, one can use the following technique
//  to rename a previous "stats" box and/or change its position
//  Root > TPaveStats *st = (TPaveStats*)gPad->GetPrimitive("stats")
//  Root > st->SetName(newname)
//  Root > st->SetX1NDC(newx1); //new x start position
//  Root > st->SetX2NDC(newx2); //new x end position
//  Root > newhist->Draw("sames")


Rene Brun

Anthony Faust wrote:
> 
>         Another email with the same subject went out a few months ago but there
> was no answer published to the group, so I thought I would try it again as it is
> something I am also interested in.
> 
>         How does one plot two or three histograms in the same
> frame (using Draw("same")) and get the statistics box for all histograms?
> I tried to replicate the relevent parts for THistPainter but could not get this
> to work.
> 
>         Another more drastic option would be to change the conditional in
> THistPainter::Paint
> 
> if (!Hoption.Same) {
>       TF1 *fit = (TF1*)fFunctions->First();
>       if (!fH->TestBit(TH1::kNoStats)) {  // bit set via TH1::SetStats
>          PaintStat(gStyle->GetOptStat(),fit);
>       }
>    }
> 
> to make showing all stats boxes the default behaviour, set with TH1::kNoStats,
> 
> if ( !fH->TestBit(TH1::kNoStats) ) { // bit set via TH1::SetStats
>       TF1 *fit = (TF1*)fFunctions->First();
>       PaintStat(gStyle->GetOptStat(),fit);
>    }
> 
> and have these TNamed objects created with unique names, such as hist1stat,
> hist2stat, etc., which could then be accessed by a mouse click on the histogram
> or other user code.
> 
> _____________
> Dr. Anthony A. Faust                            | Anthony.Faust@dres.dnd.ca
> Defence Research Establishment Suffield         | PH:  (403) 544-5362
> Box 4000, Medicine Hat, Alberta, CANADA T1A 8K6 | FAX: (403) 544-4704



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:44 MET