Re: Axis ranges

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Dec 12 1997 - 12:12:51 MET


Bosko Ivanisevic wrote:

>  Hi, I have a problem defining axis ranges. For example if I try to
> change lower and upper bound of x axis in tutorial file graph.c
> using     gr->GetXaxis()->SetLimits(-2,2)    c1->Modified();
> c1->Update(); nothing happens. Also, I tried to use DrawPanel option
> but it doesn't show for TGraph object. On the other hand changing the
> axis ranges for TH1 objects is very simple through slider on
> DrawPanel, but I couldn't do it in macro. Is there any way to change
> the range of x axis for TGraph object in macro?

TGraph::DrawPanel is not yet implemented.
With your version, a convenient way to set the range in a pad is
     pad->DrawFrame(xmin,ymin,xmax,ymax);
and then draw the graph
     gr->Draw("lp");  //do not specify option "A"

For TH1 objects, you can set the axis range in a macro with
    h->GetXaxis()->SetRange(xbinmin, xbinmax)
and for a 2-d histogram
   h->GetYaxis()->SetRange(ybinmin, ybinmax)

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:22 MET