I want update a TGraph2D every time I add point to simulate a trajectory.
The following code update the canvas and axis but not the point.
If I remove Update() and ProcessEvents(), the macro draw correctly all points at the same time. I tried with and without ProcessEvents() but nothing works.
Thanks.
Macro.C
{
auto c = new TCanvas ("c","", 1000, 1000 ,1000 ,1000);
auto gr = new TGraph2D();
gr->SetMarkerStyle(20);
gr->Draw("P");
for(int i=0; i<30; i++){
gr->SetPoint(gr->GetN(), i+1, i-1, 1);
gPad->Modified();
gPad->Update();
gSystem->ProcessEvents();
}
gr->Print();
}
_ROOT Version: 6.28/06
_Platform: Ubuntu 22.04
_Compiler: g++ v11.4.0