October 2018
Beginner to intermediate
676 pages
18h 30m
English
The following are the steps to implement the required logic:
fig, ax = plt.subplots()
xdata, ydata = [], []line, = ax.plot(xdata, ydata)
ax.set_xlim(0, 10)ax.set_ylim(-3.0, 3.0)ax.grid()
def frame_gen(x=0): while x < 50: x += 0.1 yield x, np.tan(2*np.pi*x) * np.exp(-x/5.)
def animate(data): x, y = data xdata.append(x) ydata.append(y) xmin, xmax = ax.get_xlim() if x >= xmax: ax.set_xlim(xmin, 2*xmax) ax.figure.canvas.draw() line.set_data(xdata, ydata) return line
ani = FuncAnimation(fig, ...
Read now
Unlock full access