Acquire the fit line of TGraph

the Draw ("AC*) option fits a graph with a smooth and nice curve:
point_graph2.pdf (13 KB)

For a long time I have been trying to discover how to access the values of this curve and to compute using the Eval function any value along the curve. Obviously the graph->Eval(x) function does not provide so a nice fit (you see kinks in it):
marker_canvas.pdf (13.7 KB)

Also, I am interested in some documentation how to use splines in graph->Eval(x, “spline”, “option”).


The C option in TGraph is not a smoothing or fitting tools it is just a visualisation technique which makes the curves look nicer. But it has a lot of limitations (see the doc). To do what you are asking for, I would recommend to use fitting.

Thanks. I encountered some difficulties using a polynomial fit for this graph (it did not fit very vell so that it passes through all points and does not drop to negative values). Will using TSpline offer some advantages to acomplish a nice fit and what would be simple code using a TSpline on this graph?

You can use other fit than polynomial if needed.