# A Smooth TGraphErrors

Hello All,
I want a smooth graph (with 50 points) with y errors from a given TGraphErrors. The code is here

``````void graphSmooth()
{
double xx[9] = {0.075 , 0.575 , 1.5 , 2.5 , 3.5 , 4.5 , 6 , 8.5 , 12.5};
double yy[9] = {0.436485 , 1.16199 , 1.22038 , 1.1429 , 0.667965 , 0.246795 , 0.0749268 , 0.0385441 , 0.0375758};
double xx_err[9] = {0.0};
double yy_err[9] = {0.115663 , 0.32901 , 0.344768 , 0.321792 , 0.185107 , 0.0611927 , 0.00988271 , 0.00041491 , 6.94694e-07};
TGraphErrors * gr = new TGraphErrors(9,xx,yy,xx_err,yy_err);
gr->Draw("AP*");
}
``````

Is it possible?

`gr->Draw("AC*");`

Thanks @Wile_E_Coyote
This is to draw it as I already know
But somehow, can I get more y points and their corresponding y errors from these given points using inbuilt interpolation methods in ROOT? e.g., I have 9 points in given x-range. How can I get 3 or 4 more points (with y errors) in between each of two points?

You can try (but I know nothing for the “y errors”):

``````gr->Sort(); // just a precaution
TF1 *f = new TF1("f",
[=](double *x, double */*p*/){ return gr->Eval(x[0], 0, "S"); },
gr->GetX()[0], gr->GetX()[(gr->GetN() - 1)], 0);
gr->Draw("AC*");
f->Draw("SAME");
``````

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.