removeLastPoints( Int_t lastPoints=0 ) { gROOT->SetStyle("Plain"); gStyle->SetOptTitle(0); const Int_t n = 5; Float_t y[n] = {5.,7.,10.,14.,16.}; Float_t ey[n] = {0.,0.,0.,0.,0.}; Float_t x[n] = {5.,7.,9.,13.,15.}; Float_t ex[n] = {0.01,0.02,0.02,0.01,0.01}; TGraphErrors *graph = new TGraphErrors(n,x,y,ex,ey); //graph->Draw("A*"); graph->Print(); for (int i=graph->GetN()-lastPoints; iGetN(); i++) { cout << " Removing point " << i << " of the graph " << endl; graph->RemovePoint(i); } cout << endl; graph->Print(); cout << endl; }