Re: [ROOT] Colors of the individual bins

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat May 03 2003 - 07:34:45 MEST


Hi Vitaliy,

see example below

Rene Brun


void hbars2() {
   TH1F *h1 = new TH1F("h1","main",20,-2,2);
   h1->FillRandom("gaus",500);
   h1->SetFillColor(38);
   TH1F *h2 = (TH1F*)h1->Clone("h2");
   h2->Reset();
   h2->SetBinContent(14,h1->GetBinContent(14));
   h2->SetFillColor(50);
   h1->Draw("bar2");
   h2->Draw("bar2 same");
}
  
On Fri, 2 May 2003, Vitaliy 
Ziskin wrote:

> Is there a way to set the color of an idividual bin in the histogram.  I have a bar chart and I would like to change the color of a bar if it goes over
> 
> or under a certain value.
> 
>                                     Best regards, Vitaliy
> 
> =====================================================================
> Vitaliy Ziskin                                Tel: (617)253-9209
> MIT 26-547                          http://www.lns.mit.edu/people/vziskin/
> 77 Massachusetts Ave
> Cambridge, Ma
> 02139
> ======================================================================
>         "For long you live and high you fly
>          And smiles you'll give and tears you'll cry
>          And all you touch and all you see
>          Is all your life will ever be"--Pink Floyd
> 
> 
> 



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