[ROOT] Re: THStack and suppressing histogram error bars

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jan 21 2003 - 08:17:04 MET


Hi Amanda,

An example

{
   THStack *hs = new THStack("hs","test stacked histograms");
   TH1F *h1 = new TH1F("h1","test hstack",100,-4,4);
   h1->Sumw2();
   h1->FillRandom("gaus",20000);
   h1->SetFillColor(kRed);
   h1->SetMarkerStyle(21);
   h1->SetMarkerColor(kRed);
   hs->Add(h1,"hist");
   TH1F *h2 = new TH1F("h2","test hstack",100,-4,4);
   h2->Sumw2();
   h2->FillRandom("gaus",15000);
   h2->SetFillColor(kBlue);
   h2->SetMarkerStyle(21);
   h2->SetMarkerColor(kBlue);
   hs->Add(h2,"hist");
   TH1F *h3 = new TH1F("h3","test hstack",100,-4,4);
   h3->FillRandom("gaus",10000);
   h3->SetFillColor(kGreen);
   h3->SetMarkerStyle(21);
   h3->SetMarkerColor(kGreen);
   hs->Add(h3);
   hs->Draw();
}

Rene Brun


On Mon, 20 
Jan 2003, Amanda Weinstein wrote:

> 
> I have a set of histograms that I want to use THStack to plot in
> a stacked fashion.  For other reasons, these histograms have had
> the Sumw2() option invoked, but when doing the stacked plots, I
> want the error bars suppressed and the fill colors honored.
> 
> If, however, I try doing
> 
> stack->Draw("hist")
> 
> it only draws the first histogram in the list and leaves out all the
> others.  Using SetDrawOption or SetOption for each histogram individually
> does not seem to help, the stack seems to "lose" these settings.  Does
> anyone have any suggestions about what I should be doing here?
> 
> 				Thanks,
> 				  Amanda
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:08 MET