import numpy as np
import time
import plotly.plotly as py
import plotly.tools as tls
from plotly.graph_objs import *
stream = dict(token=tls.get_credentials_file()['stream_ids'][0], maxpoints=600)
py.plot([Scatter(x=[], y=[], mode='markers', marker=Marker(size=3), stream=stream)], auto_open=False, filename='serpinski')
u'https://plot.ly/~etpinard/275'
my_stream = py.Stream(tls.get_credentials_file()['stream_ids'][0])
my_stream.open()
while True:
x, y, s = np.random.rand(3)
rgba = np.random.rand(4)
data = dict(x=x, y=y, marker=Marker(size=20*s, color='rgba({},{},{},{})'.format(*rgba)))
my_stream.write(data, layout=Layout(title="({},{})".format(x,y)))
time.sleep(.08)
--------------------------------------------------------------------------- KeyboardInterrupt Traceback (most recent call last) <ipython-input-4-444798100b9d> in <module>() 4 data = dict(x=x, y=y, marker=Marker(size=20*s, color='rgba({},{},{},{})'.format(*rgba))) 5 my_stream.write(data, layout=Layout(title="({},{})".format(x,y))) ----> 6 time.sleep(.08) KeyboardInterrupt: