// Author: Bernhard Linseisen { TCanvas *c1 = new TCanvas("window 1","A seemingly simple fit...", 1500, 800); c1->SetFillColor(0); c1->SetGrid(); TLegend *legend = new TLegend(0.7,0.65,0.88,0.9); legend->SetTextFont(72); legend->SetTextSize(0.05); TGraph *gr1 = new TGraph("data", "%lg %lg"); TF1 *f = new TF1("f", "[4] * x^4 + [3] * x^3 + [2] * x^2 + [1] * x + [0]"); gr1.Fit(f); gr1->SetTitle("Fitting some values; x-Axis; y-Axis"); gr1->SetLineColor(1); legend->AddEntry(gr1); gr1->Draw("AL"); c1->BuildLegend(); c1->Update(); }