Re: [ROOT] Setting range on axis.

From: Olivier Couet (Olivier.Couet@cern.ch)
Date: Tue Mar 23 2004 - 13:29:54 MET


Hi Manoj,

 One possible way is;

{
   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);
   TH1F *h1 = new TH1F("","",100,0,5);
   h1->SetMaximum(12);
   gr1->SetHistogram(h1);   
   gr1->Draw("AC*");
}

 Cheers,      Olivier

On Tue, 23 Mar 2004, 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
> 
> 

-- 
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:06 MET