Drawing a TGraphAsymmErrors


I am trying to Draw(“AP”); a TGraphAsymmErrors * with an x axis range of 0 to 1. I use SetRangeUser(0.0,1.0), but the resulting figure has an axis from 0.0 to 0.45 or so. Does anyone know how to force the TGraphAsymmErrors to draw itself from 0 to 1?



MyGraph->GetXaxis()->SetLimits(xmin, xmax);


Well, maybe I’d like to ask a strange question.
Actually, “MyGraph->GetXaxis()->SetLimits(xmin, xmax);” is just a shortcut for “MyGraph->GetHistogram()->GetXaxis()->SetLimits(xmin, xmax);”.
However, there is a non-negligible difference between “MyGraph->SetM[in|ax]imum(ym[in|ax]);” and “MyGraph->GetHistogram()->SetM[in|ax]imum(ym[in|ax]);”.
And that difference exists not only for TGraph related classes but also for TF1, for example (well, maybe for more, but I didn’t trace it that much).
So, the question is … when should one use which method and why?

it should not be. TGraph::SetMinimum() code is:

void TGraph::SetMinimum(Double_t minimum)
   // Set the minimum of the graph.

   fMinimum = minimum;

Yes, the differences are related to lines in form:
fMinimum = minimum; // [TGraph|TF1]::SetMinimum(Double_t minimum)
fMaximum = maximum; // [TGraph|TF1]::SetMaximum(Double_t maximum)
which are executed when one calls “[TGraph|TF1]::SetM[in|ax]imum(Double_t m[in|ax]imum)”, but which are NOT executed when one uses “[TGraph|TF1]::GetHistogram()->SetM[in|ax]imum(Double_t m[in|ax]imum);”.
It is not really obvious (nor described anywhere) what side effects these lines may cause.
Additionally, in cases like TF1, if “fHistogram” does not exist, the call to “TF1::GetHistogram()->SetM[in|ax]imum” will create and paint it, but a direct call to “TF1::SetM[in|ax]imum” will NOT care at all about the “fHistogram” (if it doesn’t exist).
So, I think a good description when one should call one method and when the other one would be nice (including a description of any possible “side effects”).