void DrawGraphWithLabelsOnPoints(TGraph *gr) { TExec *ex = new TExec("ex","DrawLabels();"); gr->GetListOfFunctions()->Add(ex); gr->Draw("ALP"); gr->GetXaxis()->SetLabelSize(0); gr->GetXaxis()->SetTickLength(0); } void DrawLabels() { Int_t i,n; Double_t x,y; TLatex *t; TLine *tick; TLine *grid; 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(); tick = new TLine(x,ymin,x,ymin+0.03*dy); tick->Paint(); grid = new TLine(x,ymin,x,y); grid->SetLineStyle(3); grid->Paint(); } }