Skip to content

Instantly share code, notes, and snippets.

@0ct0d4n
Created March 27, 2024 20:21
Show Gist options
  • Save 0ct0d4n/7a560b358586beb086d26fae1c428043 to your computer and use it in GitHub Desktop.
Save 0ct0d4n/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)
@0ct0d4n
Copy link
Author

0ct0d4n commented Mar 27, 2024

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