Re: [ROOT] Fix the Maximum value of Y- and X-axes...

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jul 09 2003 - 22:09:17 MEST


Hi Zaldy,

You can use TPad::DrawFrame as illustrated in 
$ROOTSYS/tutorials/gerrors2.C
or set the max/min via TGraph::SetMaximum/SetMinimum as shown
in the example below

{
   c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);

   c1->SetFillColor(42);
   c1->SetGrid();

   const 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);
     printf(" i %i %f %f \n",i,x[i],y[i]);
   }
   gr = new TGraph(n,x,y);
   gr->SetMaximum(14);
   gr->SetMinimum(-2);
   gr->Draw("ACP");
}

I strongly encourage you to go to the list of tutorials and read
the Root Users Guide.

Rene Brun

On Wed, 
9 Jul 
2003, zaldy wrote:

> 
> Dear ROOT Users,
> 
> I would like to know how to set and then fix the values of the Maximum as 
> well as Minimum of the Axes.
> 
> In plotting the points via TGraph, there is a method of TGraph, Draw("A"), 
> where the axes are  automatically drawn. As a result the upper and lower 
> bound of the axes depends on the value of the plotted points; not fix.
> 
> What if one wansts to fix a predefined maximum values of the axes, and 
> allow the points to find their places via their coordinate values, how do 
> we implement this?
> 
> Thank you.
> 
> 
> --------------------------------------------------------
>                    Zaldy A. Nawang 
>                    PS Users Room 2
>                    Yon Gokan, 
>                    E362, Neutrino Group, 
>                    IPNS, KEK, 
>                    Japan 
>                     
>                    e-mail: zaldy@neutrino.kek.jp
>                    Tel. No. : (81) 029864 - 5387
> --------------------------------------------------------
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET