# Smoothing or averaging plots to better represent trends and their variations

My picture looks like this. It shows some percent variation but, due to fluctuations, curves are not very smooth at all.

I would like to draw a smoother image, without altering too much the data (it is okay if the graph is not a perfect representation of the data). I am using matplotlib to draw the data, and my code looks like this:

x = df["Value"].shift(period)+1
y = 100*df["Value"].diff(period)/(period*x)


Basically, it draws the variation from the total over a period. What is the suggested way to alter the points (possibly drawing them alongside) the original data, so that the graphs do not look so jagged?

I tried just drawing every other third point, doing:

w = x[2::3]
z = y[2::3]


but I am sure there are better ways to do this. Again, this is for a nice representation only and I am mostly interested in showing a trend or any variation of it, not in showing the exact data points.

Alternatively, you can use exponential smoothing functions, such as savgol filter available in scipy, LOESS smoothing, or Holt-Winters smoothing. The statsmodels.tsa submodule made many smoothing techniques available.