Created
March 7, 2022 13:09
-
-
Save vermavinay982/39113bb0bdf9c25c79e9e54a3812ff13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can read the full blog here: https://medium.com/@vermavinay982/dynamic-graph-plotting-matplotlib-63c94d8fa99f