Re: [ROOT] THStack Limits

From: Jiri Masik (masik@fzu.cz)
Date: Fri Jun 18 2004 - 13:01:25 MEST


Matthew D Wood <mdwood@lotus.phys.northwestern.edu> writes:

> Hi.  I am trying to draw multiple histograms on the same canvas using the
> THStack class.  I notice that when I try to look at histograms on a log
> scale the limits of the axis don't get set properly.  Below I include the
> example code.  In this example the lower limit gets set to 100 so the
> contents of the second histogram are not visible.  
> 	I am using the root version 4.00/04 with gcc 2.96 and RH
> 7.1.  Thanks for your help.
>
> Matthew Wood
>
> {
>
> TCanvas *c1 = new TCanvas();
> gPad->SetLogy();
>
> TH1F *hist1 = new TH1F("hist1","hist1",100,0,10);
> TH1F *hist2 = new TH1F("hist2","hist2",100,0,10);
>
> hist1->Fill(1,1E5);
> hist2->Fill(2,1);
>
> THStack *hs = new THStack();
>
> hs->Add(hist1);
> hs->Add(hist2);
>
> hs->Draw("nostack");
>
>
> }

Hi Matthew,

when the log scale is on and the minimum of the stacked histograms is 0.,
the value of maximum/1000. is used as the minimum for stack drawing. 
I'll submit a modification to look for a non-zero minimum in this case. 
You can use hs->SetMinimum for the time being.
cheers

Jiri



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET