"SetRangeUser" dosen't work. Why?

Dear everyone,

Hi there!
I am a master course student studying high energy physics in Japan.
I quite often use the “ROOT”, it’s absolutely wonderful tool.

By the way, I couldn’t use a “SetRangeUser” function in under case.
If someone know the reason, please teach me.

P.S.
I tried under codes on ROOT 3.03 on Linux and 5.10 on Windows XP.
5.10 on XP works only Y axis.

commands:
$root -l
ROOT[0].X Sample.cxx

codes:
#include “TROOT.h”
#include "TRint.h"
gROOT->Reset();

void Sample (void) {
const Int_t number_of_data = 3;
Double_t x_data[number_of_data] = {
35.0,
39.0,
190.0
};
Double_t y_data[number_of_data] = {
260.0,
200.0,
90.0
};
TGraph *graph = new TGraph (
number_of_data,
x_data,
y_data
);
TCanvas c1 = new TCanvas (“c1”, “Test”, 200, 10, 600, 400);
graph->SetMarkerStyle (2);
graph->Draw (“AP”);
/
Why doesn’t the under lines work? */
graph->GetXaxis ()->SetRangeUser (0.0, 200.0);
graph->GetYaxis ()->SetRangeUser (0.0, 300.0);
graph->Draw (“AP”);

c1->Update();
}

use TAxis::SetLimits(xmin, xmax)

#include "TGraph.h"
#include "TCanvas.h"

void Sample() {
  const Int_t number_of_data = 3;
  Double_t x_data[number_of_data] = {
    35.0,
    39.0,
    190.0
  };
  Double_t y_data[number_of_data] = {
    260.0,
    200.0,
    90.0
  };
  TGraph *graph = new TGraph (
			      number_of_data,
			      x_data,
			      y_data
			      );
  TCanvas *c1 = new TCanvas ("c1", "Test", 200, 10, 600, 400);
  graph->SetMarkerStyle(2);
  graph->Draw("AP");
  
  Printf("graph x limits %g, %g", graph->GetXaxis()->GetXmin(),
	 graph->GetXaxis()->GetXmax());
  graph->GetXaxis()->SetRangeUser(0.0, 200.0); // "without effect" if outside limits
  graph->GetXaxis()->SetLimits(0, 200);
  Printf("graph x limits %g, %g", graph->GetXaxis()->GetXmin(),
	 graph->GetXaxis()->GetXmax());
  graph->GetXaxis()->SetRangeUser(0, 200);
  
  c1->Modified();
  c1->Update();
}

and see root.cern.ch/root/htmldoc/TAxis.html for more info.

Jan

btw I strongly recommend high version of ROOT(5.12.00, jul2006)

Dear Jan,

Thank you very much.
Your suggestion works for me!
I appriciate for your help.

Thanks,

Kazu