ROOT Version: 6.22
Platform: Ubuntu
I want to plot error bars and fit the graph along with it. The code I have written is,
{
f = new TF1("fit", "[0]*x + [1]",0,5);
f -> SetParNames("Slope", "Interceptor");
double x[5]={2.68,4.73,0.415, 4.34, 4.73}, y[5] = {661.66, 1274.54,122.061, 1173.24, 1332.51}, xerr[5]= {0.119,0.10625, 0.10625, 0.204, 0.21675}, yerr[5]={0,0,0,0,0};
g = new TGraphErrors(5, x, y, xerr, yerr);
g -> Fit(fit, "R"); // Had also put f instead of fit and trying without "R" also but same graph showing
g->Draw(); // Also tried with "AP" , "A", "A*" but nothing happened
}
But there is still a problem remains. the fitting line did not show up on the graph.
please help me on it.
Thank you,
Dsubhro.