Skip to content

Instantly share code, notes, and snippets.

@vaclavcadek
Created April 19, 2017 12:07
Show Gist options
  • Save vaclavcadek/97f67674c17976e64270f10015195775 to your computer and use it in GitHub Desktop.
Save vaclavcadek/97f67674c17976e64270f10015195775 to your computer and use it in GitHub Desktop.
%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
import time
def pltsin(ax, colors=['b']):
x = np.linspace(0,1,100)
if ax.lines:
for line in ax.lines:
line.set_xdata(x)
y = np.random.random(size=(100,1))
line.set_ydata(y)
else:
for color in colors:
y = np.random.random(size=(100,1))
ax.plot(x, y, color)
fig.canvas.draw()
fig,ax = plt.subplots(1,1)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_xlim(0,1)
ax.set_ylim(0,1)
for f in range(10):
pltsin(ax, ['b', 'r'])
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment