Subpad coordinates

Hi all,

I’m looking to draw a horizontal line in a sub-pad (created with TCanvas::Divide()), going from the X axis minimum value to its max value:

  TGraphErrors *magres = new TGraphErrors(mlig, mjd, mmag, mjde, merr);
  TCanvas *c1 = new TCanvas("c1","",0,0,700,900);
  double xmin = gPad->GetUxmin();
  double xmax = gPad->GetUxmax();
 TLine *zero = new TLine(xmin, 0, xmax, 0);

But, xmin = 0, xmax = 1, instead of ~80 and ~170 respectively.
I suspect that gPad refers not to the current subpad but to the global Pad?
If so, how to get the user coordinates of a sub-pad window?

Many thanks for any help!

Can you send a working example ?