Created
July 16, 2014 15:16
-
-
Save induhub/8754117e702c4cc542d0 to your computer and use it in GitHub Desktop.
plotly_stream.py
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 plotly.plotly as py | |
from plotly.graph_objs import Figure,Data,Scatter | |
from random import randint | |
import time | |
t=1 | |
my_data = Data([Scatter(x=[],y=[], | |
stream=dict(token='akxp47t0xu'))]) | |
my_fig = Figure(data=my_data) | |
py.plot(my_fig) | |
s = py.Stream('akxp47t0xu') | |
s.open() | |
while True: | |
p = randint(1,9) | |
s.write(dict(x=t+1,y=p)) | |
t= t+1 | |
time.sleep(1) | |
s.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment