Change fit parameters names and add units

Root version: 4.04/02g from source
OS: Linux

Above is the function I use to fit. When plotting the fit statistics, is there a way that I can change the variable names from p0 and p1 to, for example, slope and intersect? I would also like to add units, if possible.

Lastly, is it possible just to plot one of the variables but not the other?

Ideally, I would just have “Slope x +/- y widget units”.

Thanks for any help

see example below

void rline() { TF1 *f1 = new TF1("f1","pol1",8,25); f1->SetParNames("Slope","Widget"); f1->SetParameters(1,1); TH1F *h = new TH1F("h","test",100,8,25); h->FillRandom("f1",10000); gStyle->SetOptFit(); h->Fit(f1); TPaveLabel *p = new TPaveLabel(.5,.2,.85,.25 ,Form("Slope:%g #pm %g widget units",f1->GetParameter(0),f1->GetParameter(1)) ,"brNDC"); p->Draw(); }
Rene

1 Like

Thank you for the prompt help