Created
December 9, 2015 19:27
-
-
Save thegreatshasha/c06e1f47309a45201d60 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
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