TGraph::SetPoint makes axes forget their titles

Hi Rooters,

I’ve noticed that if I do this:

TGraph g(2);
g.SetPoint(1,0,0);
g.SetPoint(2,1,1);
g.GetXaxis()->SetTitle("X axis");
g.Draw("APL");

then I see the title on the X axis as expected. But if I do this:

TGraph g(2);
g.GetXaxis()->SetTitle("X axis");
g.SetPoint(1,0,0);
g.SetPoint(2,1,1);
g.Draw("APL");

then I don’t see any label on the X axis.

Can I persuade a title axis to be “sticky” so that I can add points to the graph after setting it and not lose it?

Cheers

This problem is fixed in CVS.
In the previous version (your version), the intermediate histogram used to draw the graph was systematically deleted when one point was added or modified.

Rene

Rene,

TGraph::SetPoint method can be used to add a new point
to the graph. Removing of the histogram had a side effect
that following call of TGraph::Paint computed new ranges
for the histogram axes and new points became visible
even if they were outside of old axis limits. It seems
that now it’s user’s responsibility to update the axis ranges.

Maxim