In [ ]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from IPython import display
x = np.linspace(0, 6*np.pi, 100)
y = np.sin(x)
fig = plt.figure()
ax = fig.add_subplot(111)
line1, = ax.plot(x, y, 'r-') # Returns a tuple of line objects, thus the comma
for phase in np.linspace(0, 10*np.pi, 500):
line1.set_ydata(np.sin(x + phase))
display.clear_output(wait=True)
display.display(plt.gcf())
In [ ]: