human
I am working on the file "Catmull-Rom-splines.ipynb".
The first task is:
The green curve is the centripetal CR spline interpolating the central 4 from 6  points. It folows closely
the given interpolatory points.
In order to get more insights into  CR curves properties we give the possibility to generate them interactively.
Choose the interpolatory points, by clicking the left mouse button at the desired position. When the   right button is pressed, the corresponding curve is generated:
Can you write Python code for it?
 What is a the Python code you requested?
assistant
#Here is the Python code you requested.

#enable interactivity in notebook:
%matplotlib notebook 

def curve_plot(i_pts,  alpha=0.5, closed=False):
    curve_pts=Catmull_Rom(i_pts, alpha, closed=closed)
    # plot the interpolating curve
    plt.plot(curve_pts[:,0], curve_pts[:,1], 'b') 

class catrom(object): 
    
    def __init__(self,  alpha=0.5, closed=False):
        self.interp_pts=[]     # list of interpolating points
        self.alpha=alpha
        self.closed=closed# boolean value
    def callback(self, event):  #select interpolating points with  left  mouse button click
        if event.button==1 and event.inaxes:
            x,y = event.xdata, event.ydata
            self.interp_pts.append([x,y])  
            plt.plot(x, y,  'bo') 
       
        elif event.button==3:   #press right  button to plot the curve
            curve_plot(self.interp_pts,  self.alpha, self.closed)
            plt.draw() 
            
        else: pass
        
    def caxis(self):#define axes for plot
        fig = plt.figure(figsize=(8, 6))
        ax = fig.add_subplot(111)
       
        ax.set_xlim(0,10)
        ax.set_ylim(0,10)
        ax.grid('on')   
        ax.set_autoscale_on(False)
        fig.canvas.mpl_connect('button_press_event', self.callback)

curve=catrom()
curve.caxis()

cv=catrom(closed=True)
cv.caxis()

cv2=catrom(alpha=0)
cv2.caxis()