RE: [ROOT] Setting range on axis.

From: Manoj Jha (Manoj.Jha@cern.ch)
Date: Tue Mar 23 2004 - 13:24:29 MET


Hi Rene,
  Lot of thanks . It worked.

Thanks and with regards,
manoj



-----Original Message-----
From:	Rene Brun
Sent:	Tue 3/23/2004 1:02 PM
To:	Manoj Jha
Cc:	roottalk@pcroot.cern.ch
Subject:	Re: [ROOT] Setting range on axis.

Use SetLimits instead of SetRangeUser

{
Int_t n=20;
Double_t x[n],y[n];
 for (Int_t i=0; i<n; i++)
     { x[i]=i*0.1;
	     y[i]=10*sin(x[i]+0.2);
     }
TGraph *gr1 = new TGraph (n,x,y);
TAxis *axis = gr1->GetXaxis();
axis->SetLimits(0,5);
gr1->Draw("AC*");
}


SetRangeUser may be used to specify a zoom on an already drawn axis.

Rene Brun

Manoj Jha wrote:
> 
> Dear rooters,
>       I am facing problem in setting range of the axis of the graph. For
> this purpose, I had written a root scripts and  attaching it (51.C).  In
> the scripts, I am trying to  set the range of the  X axis from (0,5).
> But, it is taking the default one (0,2). I am also attaching the output
> (graph.ps) that i am getting from the root script (51.C).  Please let me
> know the possible solution for it.
> 
> With best wishes ,
> manoj
> 
>   --------------------------------------------------------------------------------
>            Name: 51.C
>    51.C    Type: Plain Text (text/plain)
>        Encoding: 7bit
> 
>                Name: graph.ps
>    graph.ps    Type: Postscript Document (application/postscript)
>            Encoding: 7bit



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