Skip to content

Instantly share code, notes, and snippets.

@thegreatshasha
Created December 9, 2015 19:27
Show Gist options
  • Save thegreatshasha/c06e1f47309a45201d60 to your computer and use it in GitHub Desktop.
Save thegreatshasha/c06e1f47309a45201d60 to your computer and use it in GitHub Desktop.
import plotly.plotly as p
import datetime
import time
import numpy as np
import json
from plotly.graph_objs import *
import timeit
class Plotter:
def __init__(self, config):
self.config = config
self.plot = p.iplot([{'x': [], 'y': [], 'type': 'scatter', 'mode': 'lines+markers',
'stream': {'token': self.config['streaming_token'], 'maxpoints': 80}
}],
filename='Time-Series', fileopt='overwrite')
self.url = self.plot.resource
print self.url
self.stream = p.Stream(self.config['streaming_token'])
self.stream.open()
def write(self, x, y):
self.stream.write({'x': x, 'y': y})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment