[Matplotlib] Ploting an exponential distribution frequency curve

Dave Farrance DaveFarrance at OMiTTHiSyahooANDTHiS.co.uk
Sun Apr 26 12:17:07 CEST 2015

Mario Figueiredo <marfig at gmail.com> wrote:

>Other than replacing the random module with the probability density
>function for the exponential distribution, do you have a suggestion of
>how I could smooth the curve?

Moving average. Try:

def movingaverage(interval, window_size):
    window= numpy.ones(int(window_size))/float(window_size)
    return numpy.convolve(interval, window, 'same')

y_av = movingaverage(y,10)

Note that you'd get problems at the start and end of the curve if it's
non-zero there, which is difficult to avoid with noise-reduction.

More information about the Python-list mailing list