Given a sequence of points in a 2D plane, [(x0,y0), (x1,y1), ...], I want to find a spline curve which passes through these points.
The classes in scipy.interpolate for 1D spline requires increasing x, since the list of these x-coordinates is not necessary increasing (i.e. the curve is not a function, f(x)=y, but rather a parametrised curve). Unfortunately, neither it is a function along y (otherwise by switching x and y coords the problem would be easily solved).
I have tried with the Univariate interpolation classes but this is not having the desired effect. How can I use scipy.interpolate to calculate this spline curve?
You need to reconsider how you think about this problem: Actually
xis the parameterisation of the curve (which one would usually denotetfor time) andyis thex,yco-ordinate:Then you can use various
scipy.interpolatefunctions, for example:.
For example the straight line between
(0,0)and(1,1):