Set colour, line properties to fit of TProfile


I am following this example for doing a linear fit to a 2D histogram … t2d.C.html
with only modifications to get the fit information with a TFitResultPtr.

What I wanted to know is if there is any way of adjusting the line colour and width of that fit. I saw something about ‘goption’ in the function definition but was not sure if that could solve the problem.


prof->Fit("pol1"); TF1 *f = prof->GetListOfFunctions()->FindObject("pol1"); if (f) { // f->SetLineColor(4); // 4 = "blue" f->SetLineWidth(3); f->SetLineStyle(2); // 2 = "- - -" }

Thank you, that worked perfectly.