TGraphErrors and Y axis limit

Hi, I was trying to set the limits of the Y axis for a TGraphErrors plot (the macro is still under development), but I can set the Y axis limits. No problem with X axis limits. Maybe because I am plotting using the Time Format mode. I attach the macro. I am sure you have useful comments on what I am doing…
Thanks a lot in advance
regards
Davide Perego
Laboratorio2007_test.C (3.67 KB)

Example:

{
   Int_t n=20;
   Double_t x[n],y[n];
   for (Int_t i=0; i < n; i++) {
      x[i]=i*0.1;
      y[i]=10*sin(x[i]+0.2);
   }
   TGraph *gr1 = new TGraph (n,x,y);
   TAxis *axis = gr1->GetXaxis();

   axis->SetLimits(0.,5.);                 // along X
   gr1->GetHistogram()->SetMaximum(20.);   // along          
   gr1->GetHistogram()->SetMinimum(-20.);  //   Y     

   gr1->Draw("AC*");
}