const int Npoints = 3; // Number of points in the graph const double x[Npoints] = {1.0, 2.0, 5.0}; const double y[Npoints] = {0.5, 1.0, 2.0}; const char *c[Npoints] = {"a","b","c"}; void graphtext3() { TGraph *gr = new TGraph(Npoints, x, y); gr->SetMarkerStyle(kCircle); TExec *ex = new TExec("ex","DrawText();"); gr->GetListOfFunctions()->Add(ex); gr->Draw("ALP"); gr->GetXaxis()->SetLabelSize(0); gr->GetXaxis()->SetTickLength(0); } void DrawText() { Int_t i,n; Double_t x,y; TLatex *t; TLine *l; TGraph *g = (TGraph*)gPad->GetListOfPrimitives()->FindObject("Graph"); double ymin = g->GetHistogram()->GetMinimum(); double ymax= g->GetHistogram()->GetMaximum(); double dy = (ymax-ymin); n = g->GetN(); for (i=0; iGetPoint(i,x,y); t = new TLatex(x, ymin-0.03*dy, Form("%s (%4.2f,%4.2f)",c[i],x,y)); t->SetTextSize(0.025); t->SetTextFont(42); t->SetTextAlign(21); t->Paint(); l = new TLine(x,ymin,x,ymin+0.03*dy); l->Paint(); } }