void GraphDoubleString(TGraph *gr, std::string c[]) { gr->Draw("ALP"); gr->GetXaxis()->SetLabelSize(0); gr->GetXaxis()->SetTickLength(0); Int_t i,n; Double_t x,y; TLatex *t; TLine *tick; TLine *grid; printf("%s\n",c[0].c_str()); double ymin = gr->GetHistogram()->GetMinimum(); double ymax = gr->GetHistogram()->GetMaximum(); double dy = (ymax-ymin); n = gr->GetN(); for (i=0; iGetPoint(i,x,y); t = new TLatex(x, ymin-0.03*dy, c[i].c_str()); t->SetTextSize(0.025); t->SetTextFont(42); t->SetTextAlign(21); t->Draw(); tick = new TLine(x,ymin,x,ymin+0.03*dy); tick->Draw(); grid = new TLine(x,ymin,x,y); grid->SetLineStyle(3); grid->Draw(); } } void plot() { Double_t x[3] = {1,2,3}; Double_t y[3] = {1,5,2}; std::string colour[3] = { "Blue", "Red", "Green"}; auto gr = new TGraph(3,x,y); gr->SetMarkerStyle(20); GraphDoubleString(gr,colour); }