October 2018
Beginner to intermediate
676 pages
18h 30m
English
The following are the steps to implement the required logic:
fig, ax = plt.subplots()
x = np.arange(-10, 10, 0.01)y = 1 / (1 + np.exp(-x))line, = ax.plot(x, y)
def init(): line.set_ydata([np.nan] * len(x)) return line
def animate(i): line.set_ydata(1 / (1 + np.exp(-(x+i/100)))) # keep refreshing frame by frame return line,
ani = FuncAnimation(fig, animate, 1000, init_func=init, blit=True, interval=2, save_count=50, repeat=False, repeat_delay=1000)
Read now
Unlock full access