How to achieve variable fps in Python animation?
<p>I have a list of co-ordinates for a closed curve. I want to plot a circle with those points as centers such that it appears as if the circle is moving on the curve when the point is iterated. The problem I am facing is that the distribution of data is not uniform with the angle subtended at origin, i.e, I have a larger number of co-ordinates near y-axis and lesser near x-axis (refer fig. for an idea about the distribution). How do i make the animation appear as if the point is moving with constant angular speed? I mean i will have to have a larger delay between frames when point is near y-axis and smaller near x-axis.
I am new to Python, and even newer to animation, so any help is appreciated.
<a href="http://i.stack.imgur.com/oFSJk.jpg" rel="nofollow">distribution of co-ordinates from the list</a></p>

<pre><code>import numpy as np
from matplotlib import pyplot
from matplotlib import animation

n=int(raw_input("Enter the number of data points: "))
R=raw_input("Enter the radius of smaller circle: ")
R=float(R)

profile_data=open('profile_data.txt','r')
x=[0]*n
y=[0]*n
x_C=[0]*n
y_C=[0]*n
for i in range(n):
    temp=profile_data.readline()
    x[i],y[i]=temp.split()
    x[i]=float(x[i])
    y[i]=float(y[i])
profile_data.close()

fig=pyplot.figure()
ax=pyplot.axes(xlim=(-10,10),ylim=(-10,10))
curves,=ax.plot([], [],lw=2)

def init():
    curves.set_data([], [])
    return curves,

def animate(i):
    for j in range(360):
        x_C[j]=x[i]+R*np.cos(j*np.pi/180)
        y_C[j]=y[i]+R*np.sin(j*np.pi/180)
    curves.set_data(x_C, y_C)
    return curves,

anim = animation.FuncAnimation(fig, animate, init_func=init,frames=n, interval=20, blit=True)
pyplot.show()
</code></pre>