The problem when drawing TGraph

The problem is when drawing one graph two times, the second one is not right.
First draw the graph to one Canvas, then, change the graph, and draw it again, but the graph is not updated.
The test code is like this. The first draw is right, then another 10 points are added to the graph, but after Draw(), the graph is not updated.
Then I find that ROOT 5.13, 5.14 have this problem, but ROOT 4.01 is OK, don’t have this problem.
So can any body tell me why, thanks very much.

void drawgraph()
{
int i;
TCanvas *c = new TCanvas(“c”, “C”, 0, 0, 600, 300);
c->Divide(2);
TGraph *g = new TGraph();
g->SetMarkerStyle(20);
for(i=0; i<10>SetPoint(i, i, i);
}
c->cd(1);
g->Draw(“APL”);
c->Modified();
c->Update();

for(i=10; i<20>SetPoint(i, i, i*2);
}
c->cd(2);
g->Draw("ALP");
c->Modified();
c->Update();

}

Hi,

I moved your post from Documentation to ROOT Support.

Cheers, Ilka

Use DrawCopy instead of Draw

Rene

When I simply change Draw to DrawCopy, it said “no matching function for call to `TGraph::DrawCopy”, so why?

But DrawClone is able to use, and solved the problem, thanks.