Skip to content

Instantly share code, notes, and snippets.

@louiskirsch
Created October 20, 2017 15:18
Show Gist options
  • Save louiskirsch/efd4eae084859d66feb1e6f02ec27f55 to your computer and use it in GitHub Desktop.
Save louiskirsch/efd4eae084859d66feb1e6f02ec27f55 to your computer and use it in GitHub Desktop.
fig, ax = plt.subplots()
ax.set_title('Figure 2 - Progressing samples')
ax.set_xlabel('Erruption length')
ax.set_ylabel('Time since last erruption')
ax.set_xlim((np.min(x[:, 0]), np.max(x[:, 0])))
ax.set_ylim((np.min(x[:, 1]), np.max(x[:, 1])))
line, = ax.plot([], [])
def init():
line.set_data([], [])
return (line,)
def animate(i):
n = i + 1
line.set_data(x[:n, 0], x[:n, 1])
return (line,)
anim = animation.FuncAnimation(fig, animate, init_func=init,
frames=N, interval=200, blit=True)
HTML(anim.to_html5_video())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment