RE: highlighting part of the histogram

From: Aamer Wali Rauf <aamer.wali.rauf_at_cern.ch>
Date: Sun, 4 Sep 2011 15:00:31 +0000


Dear Rene,

Please see the attachments.

Thanks,
Aamer



From: Rene Brun
Sent: 04 September 2011 14:34
To: Aamer Wali Rauf
Cc: roottalk_at_root.cern.ch
Subject: Re: [ROOT] highlighting part of the histogram

Could you post a short macro implementing my way and the small data file containing your histogram?

Rene

On 04/09/2011 14:26, Aamer Wali Rauf wrote: Dear Rene,

I tried it, but it did not work for me. I exactly followed your instructions. I must mention that the original histogram I extracted from TList if histograms in TDirectoryFile in TFile. I don't think that should make any difference to how I get to the first instruction in your set.

Regards,
Aamer



From: Rene Brun
Sent: 04 September 2011 11:45
To: Aamer Wali Rauf
Cc: roottalk_at_root.cern.ch<mailto:roottalk_at_root.cern.ch> Subject: Re: [ROOT] highlighting part of the histogram

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 - 17:00:40 CEST

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