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


Question

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?

1
6
7/26/2016 8:46:42 AM

Accepted Answer

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.

6
3/10/2011 6:14:55 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon