Adding points to a graph

Currently I use this to add points to a TGraph *:


Is there a way to do this without having to keep track of the index i? That is, can you do



You can do

g->SetPoint(g->GetN(), x,y)

That’s what I do 95% of the time. Perhaps such a default method could be added to ROOT?

1 Like

thanks – that’s what I wanted