Unable to set the x axis range of a TGraph

Hi all,
I cannot set the x-axis range of the TGraphError below using the SetRangeUser() method.
I am almost sure I am doing something ridiculous, but can someone please help me figure that out ?
Everytime I get the same axis range from about 1140. 1240.


void increase_axis(){
	
	TCanvas *c1 = new TCanvas("c1","c1");
	
        const int n = 3;
        double x[n]= {1148,  1186.5, 1229.9};
        double y[n]= {640.61, 731.72, 756.98};
        double err_y[n] = {27.16,  22.98 , 51.83};
       
   
	auto g = new TGraphErrors(n,x,y,nullptr, err_y);
	g->Draw("ap");
  	g->GetXaxis()->SetRangeUser(00, 1400);
        
        gPad->Update();
        gPad->Modified();
  	
}
Thanks a lot




SetRange and SetRangeUser access the underlying histogram used to draw axis. They can only zoom, not unzoom (ie: increase the scales). The way to do it is:

void increase_axis(){
   auto c1 = new TCanvas("c1","c1");
   const int n = 3;
   double x[n]= {1148,  1186.5, 1229.9};
   double y[n]= {640.61, 731.72, 756.98};
   double err_y[n] = {27.16,  22.98 , 51.83};
   c1->DrawFrame(0., 580., 1400, 850);
   auto g = new TGraphErrors(n,x,y,nullptr, err_y);
   g->Draw("p");
}
2 Likes