Re: [ROOT] x axis range

From: Suzanne Panacek (spanacek@fnal.gov)
Date: Thu Dec 07 2000 - 20:51:38 MET


Hi Krister,

Use TH1::DrawFrame to set the range and then do not specify "A" for axis
when drawing the graph. For example in graph.C add the line begining with
TH1F and change the draw option in the line gr->Draw. 
{
   ....
   // the DrawFrame method takes the parameters (x1,y1,x2,y2).
   TH1F *hr = c1->DrawFrame(0,-10,2,12);
   gr = new TGraph(n,x,y);
  .
  // change this line and leave out the "A" for axis.
   gr->Draw("CP");
.
}

Suz.
----- Original Message ----- 
From: "Stephen Bailey" <bailey@physics.harvard.edu>
To: "Krister Bruhwel" <bruhwel@jlab.org>
Cc: <roottalk@pcroot.cern.ch>
Sent: Thursday, December 07, 2000 1:08 PM
Subject: Re: [ROOT] x axis range


> 
> Hi Krister.
> 
> I frequently draw a dummy blank 2D histogram just to get the
> axes I want, and then draw things like graphs or scatter plots
> on top of it using the "same" option.  I think this accomplishes
> what you want.
> 
> Stephen
> 
> On Thu, 7 Dec 2000, Krister Bruhwel wrote:
> 
> > I'm new to Root and I'm trying to make line graphs with a set Y and X
> > range so that I can visually compare graphs (same xy axis on all
> > graphs).  I
> > 've found that
> >               TGraph *graph = new TGraph(inTime.size(), x_value,
> > y_value);
> >               graph->GetXaxis()->SetMinimum(10.0);
> >               graph->GetXaxis()->SetMaximum(100.0);
> > 
> > sets the Y axis range.  How can I set the X axis range?  I've searched
> > the Root Talk and have not had any luck.
> > 
> > Thanks for any help,
> > Krister
> > 
> 
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:38 MET