Smoothing out a TGraph plot

Dear experts,

I’m trying to figure out if I can “smooth” a curve of a TGraph line that is plotted on a TH2D frame. I know that in the histogram itself, I can change the number of bins, but this doesn’t affect the TGraph.

As I am limited by the number of coordinates (x,y) that I’m reading into my graph, I cannot just add more data points to achieve “smoothness.”

I would appreciate any advice you might have on this matter. Thank you.

ROOT Version: 6.14/04
Built for macosx64
From tags/v6-14-04@v6-14-04
(I use MacBookAir.)

Hi @obitter16, welcome on the ROOT forum.

When drawing the graph you can use the “C” option.

gr->Draw("ac");

For other options look here.

Cheers,
Stefano

Hi Stefano,

Thank you so much! Yes, my TGraph is plotted much smoother now.

Cheers,
Olivia

Be careful with option C. It might produce artefact when the graph points vary a lot.