void graphmulticol() { TCanvas *c = new TCanvas("c","A Simple Graph Example with Text",700,500); c->SetGrid(); const Int_t n = 10; TGraph *gr = new TGraph(n); gr->SetTitle("A Simple Graph Example with mutiple colors"); gr->SetMarkerStyle(1); TExec *ex = new TExec("ex","DrawCol();"); gr->GetListOfFunctions()->Add(ex); Double_t x, y; for (Int_t i=0;iSetPoint(i,x,y); } gr->Draw("AP"); } void DrawCol() { Int_t i,n; Double_t x,y; TLatex *l; TGraph *g = (TGraph*)gPad->GetListOfPrimitives()->FindObject("Graph"); n = g->GetN(); TMarker *m; for (i=1; iGetPoint(i,x,y); m = new TMarker(x,y,20); m->SetMarkerColor(i);; m->Paint(); } }