Skip to content

Instantly share code, notes, and snippets.

@louiskirsch
Created March 7, 2017 08:13
Show Gist options
  • Save louiskirsch/457784bb9a3bd9013274a08006f50be4 to your computer and use it in GitHub Desktop.
Save louiskirsch/457784bb9a3bd9013274a08006f50be4 to your computer and use it in GitHub Desktop.
Matplotlib live plot
import matplotlib.pyplot as plt
import numpy as np
import time
plt.rcParams['toolbar'] = 'None'
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
def draw():
ax.clear()
x, y = np.random.rand(2, 50)
ax.scatter(x, y)
plt.pause(0.001)
while True:
draw()
time.sleep(0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment