Re: highlighting part of the histogram

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Sun, 4 Sep 2011 11:45:23 +0200


Assuming TH1* h,
left band from bins 1 to bl
right band bins from br to nbins
signal band bins from sl to sr
do:
h->Draw();
TH1 *hleft = (TH1*)h->Clone("hleft");

hleft->GetXaxis()->SetRange(1,bl);
hleft->SetFillColor(color of left band);
hleft->Draw("same");

TH1 *hright = (TH1*)h->Clone("hright");
hright->GetXaxis()->SetRange(br,nbins);
hright->SetFillColor(color of right band);
hright->Draw("same");

TH1 *hsig = (TH1*)h->Clone("hsig");
hsig->GetXaxis()->SetRange(sl,sr);
hsig->SetFillColor(color of signal band);
hsig->Draw("same");

Rene

On 03/09/2011 13:37, Aamer Wali Rauf wrote:
> Hi,
>
> Is there any way I can shade different parts of the histogram with
> different colours. What I want to do is to show the left background
> band, the right background band and the band around the signal. I want
> to have these three windows shaded different just for illustration.Thanks,
> Aamer
Received on Sun Sep 04 2011 - 11:45:32 CEST

This archive was generated by hypermail 2.2.0 : Sun Sep 04 2011 - 17:50:01 CEST