Created
September 18, 2015 11:13
-
-
Save daviddoria/027b5c158b6f200527a4 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
# -*- coding: utf-8 -*- | |
import matplotlib.pyplot as plt | |
import numpy | |
hl, = plt.plot([], []) | |
#plt.show() | |
def update_line(hl, new_data): | |
hl.set_xdata(numpy.append(hl.get_xdata(), new_data)) | |
hl.set_ydata(numpy.append(hl.get_ydata(), new_data)) | |
#ax.relim() | |
#ax.autoscale_view() | |
plt.draw() | |
arrayLen = 10 | |
data = numpy.random.rand(arrayLen) # zero-based indexing | |
update_line(hl, data) | |
while True: | |
ind = numpy.random.randint(0,arrayLen-1) | |
data[ind] = data[ind] + 1 | |
print data | |
update_line(hl, data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment