[ROOT] TGraph Xaxis range

From: Pietro Govoni (Pietro.Govoni@cern.ch)
Date: Tue Jul 09 2002 - 12:06:26 MEST


Dear rooters,
I'm trying to draw Tgraph in a certain range, narrower than the
definition's one.
The code I'm using is a simple example:

void TGraph_example()
{
 Double_t x[5];	
 Double_t y[5];
 for (Int_t i=0; i<5; i++) {x[i]=0.1*i;y[i]=10*sin(x[i]+0.2);}
 TGraph *gr = new TGraph (5,x,y);
 gr->GetXaxis()->SetRangeUser(0.2,0.4);
 gr->Draw("AC*");
}

When I use it as a sequence of prompt commands everything works properly,
but if I try to let ROOT execute them as a macro I get this error:

Processing TGraph_example.C...
Error: illegal pointer to class object GetXaxis() 0x0 126
FILE:TGraph_example.C LINE:9
*** Interpreter error recovered ***

This is my version of root:

  *   Version   3.03/05        1 May 2002   *

Is there anything that I forgot?
Thank you for your attention, regards

pietro



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:59 MET