Copying TGraph range

Hi experts,

I tried to copy the range of one TGraph to another. By trial and error, I found that for X and Y axis, I have to perform different operations:

[code]void copyTGraphRange(TGraph& in, TGraph& out)
{
//out.GetXaxis()->SetRangeUser(in.GetXaxis()->GetXmin(),in.GetXaxis()->GetXmax()); //no effect
(out.GetXaxis())=(in.GetXaxis());

out.GetYaxis()->SetRangeUser(in.GetYaxis()->GetXmin(),in.GetYaxis()->GetXmax());
//(out.GetYaxis())=(in.GetYaxis()); //no effect
}
[/code]

The complete test code is in the attachment. I tested this in 6.08.02. Could you explain why is there a difference in the treatment of the two axis? Thanks.
axisRange.C (1.19 KB)

Could anyone answer this, please?

May be this can help:

root.cern.ch/how/how-set-ranges-axis