void graphtext3() { TCanvas *c = new TCanvas("c","A Simple Graph with labels on points",700,500); const Int_t n = 10; TGraph *gr = new TGraph(n); gr->SetTitle("A Simple Graph Example with Text"); gr->SetMarkerStyle(20); TExec *ex = new TExec("ex","DrawText();"); gr->GetListOfFunctions()->Add(ex); Double_t x, y; for (Int_t i=0;iSetPoint(i,x,y); } 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("%4.2f",x)); t->SetTextSize(0.025); t->SetTextFont(42); t->SetTextAlign(21); t->Paint(); l = new TLine(x,ymin,x,ymin+0.03*dy); l->Paint(); } }