In [1]:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from IPython.display import HTML
In [2]:
fig, ax = plt.subplots()
ax.set_facecolor('black')
x = np.arange(0.0, 2*np.pi, 0.001)
y = np.sin(x)
line =plt.plot(x,y)
dot, =plt.plot([0],[np.sin(0)],'ro', markersize=12)
In [3]:
def init():
    dot.set_data([],[])
    return(dot, )
In [4]:
def animate(i):
    dot.set_data(i, np.sin(i))
    return(dot, )
In [5]:
a = animation.FuncAnimation(fig, animate, init_func=init, frames=np.arange(0.0, 2*np.pi, 0.1), interval=50, blit=True)
In [6]:
HTML(a.to_html5_video())
Out[6]: