Drawing Splines

At http://www.scipy.org/Cookbook/Matplotlib/SigmoidalFunctions I read that matplotlib supports drawing arbitrary paths with splines, but the functionality hasn't been exposed to the user. Can anyone tell me how I can use this functionality? I tried searching the source code for "spline," but I couldn't find anything useful.

(Sorry if this has been already brought up. I tried to search the archives but, weirdly enough, I couldn't find any search functionality. Perhaps it hasn't been exposed to the user, yet!)

This is lightly documented, so no worries. See the following examples

  http://matplotlib.sourceforge.net/examples/api/path_patch_demo.html
  http://matplotlib.sourceforge.net/examples/event_handling/path_editor.html
  http://matplotlib.sourceforge.net/examples/pylab_examples/dolphin.html

and the docs for the path module

  http://matplotlib.sourceforge.net/api/path_api.html

JDH

···

On Tue, Jan 27, 2009 at 12:44 PM, Mostafa Razavi <mostafa@...2471...> wrote:

At http://www.scipy.org/Cookbook/Matplotlib/SigmoidalFunctions I read
that matplotlib supports drawing arbitrary paths with splines, but the
functionality hasn't been exposed to the user. Can anyone tell me how I
can use this functionality? I tried searching the source code for
"spline," but I couldn't find anything useful.

(Sorry if this has been already brought up. I tried to search the
archives but, weirdly enough, I couldn't find any search functionality.
Perhaps it hasn't been exposed to the user, yet!)

John Hunter wrote:

  

At http://www.scipy.org/Cookbook/Matplotlib/SigmoidalFunctions I read
that matplotlib supports drawing arbitrary paths with splines, but the
functionality hasn't been exposed to the user. Can anyone tell me how I
can use this functionality? I tried searching the source code for
"spline," but I couldn't find anything useful.

(Sorry if this has been already brought up. I tried to search the
archives but, weirdly enough, I couldn't find any search functionality.
Perhaps it hasn't been exposed to the user, yet!)

This is lightly documented, so no worries. See the following examples

  http://matplotlib.sourceforge.net/examples/api/path_patch_demo.html
  http://matplotlib.sourceforge.net/examples/event_handling/path_editor.html
  http://matplotlib.sourceforge.net/examples/pylab_examples/dolphin.html

and the docs for the path module

  http://matplotlib.sourceforge.net/api/path_api.html

JDH
  
If I've got it right, the path class represents a set of bezier curves. This is not exactly what I was looking for. Bezier splines and ordinary polynomial splines are essentially the same thing, of course, but I'd rather find a way to use the latter so that I won't have to do unnecessary conversions.

Basically, my problem is that there are a set of points given and I should calculate and draw a cubic spline that interpolates them. My instructor has suggested using Matlab, but I don't have it, and I don't know how to use it. Besides, I always prefer Python, if possible. Any ideas?

···

On Tue, Jan 27, 2009 at 12:44 PM, Mostafa Razavi <mostafa@...2471...> wrote:

Mostafa Razavi wrote:
  > Basically, my problem is that there are a set of points given and I

should calculate and draw a cubic spline that interpolates them. My instructor has suggested using Matlab, but I don't have it, and I don't know how to use it. Besides, I always prefer Python, if possible. Any ideas?

Read this:

http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html