Simple curve smoothing in matplotlib --- equivalent to gnuplot's "smooth bezier"?

13,989

I think scipy's interpolation and curve-fitting functions are the closest you are going to get. I don't know of anything built into matplotlib.

Share:
13,989
Pier1 Sys
Author by

Pier1 Sys

Updated on June 21, 2022

Comments

  • Pier1 Sys
    Pier1 Sys almost 2 years

    I have a set of points I want to plot in matplotlib, say:

    x = [1,4,6,7,8]
    y = [0.2, 0.4, 0.5, 0.6, 0.6]
    

    In gnuplot, I used to be able to directly use the 'plot' command's smooth property to get a smooth curve on a graph, without having to preprocess the data.

    Is there an equivalent in matplotlib---specify a set of points, and tell it how to smooth it, bezier or spline or something like that?

    If not, what is the easiest way of accomplishing this?