Re: [ROOT] Problem with TH1F vertical scale (fwd)

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Oct 01 2002 - 18:26:43 MEST


Hi Irene,

Yes, this is the way it is supposed to work.
If you want to set a minimum, you can add a statement
like the one shown below in your code.

Rene Brun

On Tue, 1 Oct 2002, Irene FIORI wrote:

> 
> >>>>>>>>> now I included the test program (sorry!)
> 
> Dear rooters,
> I have encountered the following "unexpected" beaviour 
> of a TH1F histogram:
> I create a TH1F object and fill it with a set of (x,y) data points, 
> the y coordinate being used "as a weight".
> I find that, as long as the minimum among the y values is negative, 
> the vertical axis range is automatically set centered on the y values
> 
> Instead, if the minimum among the y values is positive
> (no matter how big it is),
> the vertical axis first value is always set to 0. !!
> 
> Below I pasted my test program,
> just try to switch OffSet between +10. and -10.
> 
> Is this the way it is supposed to work?
> ...or am I missing something ??
> How I can have the vertical range centered on y values also in the 
> second case??
> 
> Thank you,
> Irene
> 
> >>>>>>>>>>>>>>>>> test program
> 
> void test_range()
> {
>    TCanvas *c1 = new TCanvas("c1","This is a TEST",600,400);
>    TH1F *h1 = new TH1F("h1","my histogram",100,0.,100.);
>    Int_t i;
>    Float_t OffSet = +10.; // -10.
>    for (i=0;i<100;i++) h1->Fill(float(i), OffSet + gRandom->Gaus(0,1));
     h1.SetMinimum(0.95*h1->GetMinimum()); //<===========NEW
>    h1->Draw();
>    c1->Update();  
> }
> 
> 
> 
> 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:12 MET