Re: [ROOT] Axis scale

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Oct 27 2001 - 13:38:04 MEST


Hi Frank,

To scale the fit as well, you must know the fit model.
For example, supposing the histogram "hpx" from
$ROOTSYS/tutorials/hsimple.root defined between -4 and 4, you can do:
  hpx->Fit("gaus"); //you fit the original histo in [-4,4]

Now you change the histogram limits from [-4,4] to [-10,10]
  hpx->SetLimits(-10,10);

You can also change the associated fitted function (range and sigma) with
  hpx.GetFunction("gaus")->SetRange(-10,10);
  double  sigma=hpx.GetFunction("gaus")->GetParameter(2);
  hpx.GetFunction("gaus")->SetParameter(2,sigma*10/4.);

In case you change the limits assymetrically, you will also have
to change the mean value (parameter 1) of the fitted function.

Rene Brun


On Sat, 27 Oct 2001, Frank Simon wrote:

> Hi Rene,
> 
> is there a way to scale the fits (TF1) together with the histogram?
> 
> Greetings
> 
> Frank
> 
> On Sat, 27 Oct 2001, Rene Brun wrote:
> 
> > Hi Frank,
> >
> > Use TAxis::SetLimits. This works for 1,2,3-d histograms.
> > For example
> >   myhist.GetXaxis()->SetLimits(xmin,xmax)
> >
> > Rene Brun
> >
> > On Sat, 27 Oct 2001, Frank Simon wrote:
> >
> > > Hi Rooters,
> > >
> > > I want to do the following:
> > >
> > > I have a histogram with some fits drawn, and now I just want to
> > > change the axis range (without changing the look of the histogram).
> > >
> > > To be precise: The histo is in ADC channel units, and after the
> > > fits, I can calculate the absolute units (keV). Now, I want to
> > > change the x-axis accordingly, without changing the histo otherwise.
> > >
> > > Ideas?
> > >
> > > Thanks in advance...
> > >
> > > Greetings
> > >
> > > Frank
> > >
> >
> >
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:04 MET