Re: [ROOT] autoscaling Y axis of an histogram

From: Olivier Couet (couet@mail.cern.ch)
Date: Mon Jun 28 2004 - 17:29:47 MEST


Hi,

 Seems to me the zoom facility does exactly what you ask for. I have 
executed your macro, then I did a zoom on the X axis and I get the attached 
plot. As you see the Y axis doesn't start at 0.

 Cheers,     O.Couet

On Sun, 27 Jun 2004 suaide@if.usp.br wrote:

> Here it is
> 
> root 4.00/04 for windows 
> 
> h = new TH1F("h","h",100,0,10)
> for(int i=0;i<50000;i++) h->Fill(gRandom->Gaus(5,2);
> h->Draw()
> 
> I zoom from 4.5 to 5.2 and I would expect that the Y
> axis would be zoomed to because the gaussian is
> almost flat in this region. Instead of that the Y axis keeps
> starting at 0 while I would like to have it starting somewhere
> around 800-850.
> 
> Regards
> 
> Alex Suaide
> 
> 
> 
> ----- Original Message ----- 
> From: "Rene Brun" <brun@pcbrun.cern.ch>
> To: <suaide@dfn.if.usp.br>
> Cc: <suaide@if.usp.br>; <roottalk@pcroot.cern.ch>
> Sent: Sunday, June 27, 2004 3:52 AM
> Subject: Re: [ROOT] autoscaling Y axis of an histogram
> 
> 
> > Could you send an example histogram where the autoscaling does not work?
> > Indicate between which bins you are zooming.
> > Also indicate the ROOT version 
> > number.
> > 
> > Rene Brun
> > 
> > On 
> > Sat, 26 Jun 2004 suaide@dfn.if.usp.br wrote:
> > 
> > > Yes the autoscaling is indeed true but I would like
> > > to set the Y scale with limits corresponding to the
> > > minimum and maximum bin content of that region. 
> > > The histogram autoscales but it usually takes the
> > > lower limit for the y axis as zero. This is what I
> > > want to avoid.
> > > 
> > > Regards
> > > 
> > > Alex
> > > 
> > > On Sat, 26 Jun 2004, Rene Brun wrote:
> > > 
> > > > I am not sure to understand your request.
> > > > This should be the default behaviour .
> > > > 
> > > > Rene Brun
> > > > 
> > > > On Sat, 26 Jun 2004 
> > > > suaide@if.usp.br wrote:
> > > > 
> > > > > Hello all
> > > > > 
> > > > > Is it possible to define some property in the
> > > > > histogram, or axis, or somewhere else that
> > > > > enables a kind of autoscaling? I mean, for
> > > > > instance, I have one histogram that the X
> > > > > axis goes from 0 to 10 and, when I zoom
> > > > > it with the mouse from 3.5 to 5.6 it picks
> > > > > the minimum and maximum value in that
> > > > > range for the Y axis and change the limits
> > > > > in the Y axis scale to expand the histogram
> > > > > in that region. Is it possible?
> > > > > 
> > > > > Regards
> > > > > 
> > > > > Alex Suaide
> > > > > 
> > > > 
> > > > 
> > > 
> > 
> > 
> 
> 

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910      
E-Mail: Olivier.Couet@cern.ch                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7677155




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