Re: highlighting part of the histogram

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Sun, 4 Sep 2011 17:15:07 +0200


Your histogram has error bars. You must specify the draw option "hist" to force the fill area, otherwise you get all your histograms painted with the errors option and you do not see the difference. see changes in the attachment.

Rene

On 04/09/2011 17:00, Aamer Wali Rauf wrote:
> 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
>> *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:15:15 CEST

This archive was generated by hypermail 2.2.0 : Mon Sep 05 2011 - 11:50:01 CEST