Skip to content

Instantly share code, notes, and snippets.

@vermavinay982
Created March 7, 2022 13:09
Show Gist options
  • Save vermavinay982/39113bb0bdf9c25c79e9e54a3812ff13 to your computer and use it in GitHub Desktop.
Save vermavinay982/39113bb0bdf9c25c79e9e54a3812ff13 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
from collections import deque
import random
# MAX NO. OF POINTS TO STORE
que = deque(maxlen = 40)
while True:
# GENERATING THE POINTS - FOR DEMO
perc = random.random()
que.append(perc)
# PLOTTING THE POINTS
plt.plot(que)
plt.scatter(range(len(que)),que)
# SET Y AXIS RANGE
plt.ylim(-1,4)
# DRAW, PAUSE AND CLEAR
plt.draw()
plt.pause(0.1)
plt.clf()
@vermavinay982
Copy link
Author

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