Skip to content

Instantly share code, notes, and snippets.

@DataSolveProblems
Created July 16, 2019 03:48
Show Gist options
  • Save DataSolveProblems/35dfc302ef8a1cabe9377b67f85fa249 to your computer and use it in GitHub Desktop.
Save DataSolveProblems/35dfc302ef8a1cabe9377b67f85fa249 to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
x_data = []
y_data = []
fig, ax = plt.subplots()
ax.set_xlim(0, 105)
ax.set_ylim(0, 12)
line, = ax.plot(0, 0)
def animation_frame(i):
x_data.append(i * 10)
y_data.append(i)
line.set_xdata(x_data)
line.set_ydata(y_data)
return line,
animation = FuncAnimation(fig, func=animation_frame, frames=np.arange(0, 10, 0.1), interval=10)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment