Skip to content

Instantly share code, notes, and snippets.

@DanyelMorales
Created March 27, 2024 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanyelMorales/7a560b358586beb086d26fae1c428043 to your computer and use it in GitHub Desktop.
Save DanyelMorales/7a560b358586beb086d26fae1c428043 to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display, clear_output
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
for i in range(20):
x = np.arange(0, i, 0.1);
y = np.sin(x)
ax.set_xlim(0, i)
ax.cla()
ax.plot(x, y)
display(fig)
clear_output(wait = True)
plt.pause(0.5)
@DanyelMorales
Copy link
Author

This will create an animation-like graph to visualize changes overtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment