Created
June 25, 2019 18:53
-
-
Save AndresMWeber/201067a738f729ca22f1f774dc276da1 to your computer and use it in GitHub Desktop.
Template for updating a bokeh loop with data to plot.
This file contains hidden or 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
class Data(object): | |
def __init__(self, source_file): | |
self.source = source_file | |
self.routes = None | |
def update(self): | |
self.routes = self.calculate() | |
return self.routes | |
def calculate(self): | |
""" Run and find the best routes and store them | |
""" | |
pass | |
class PlotLoop(object): | |
def __init__(self): | |
self.data = Data('data_source_file') | |
self.update() | |
def init_plot(self): | |
""" Initialize the plot with data from self.data | |
""" | |
plot(self.data.routes) | |
def update(self): | |
self.data.update() | |
self.init_plot() | |
loop = PlotLoop() | |
curdoc().add_periodic_callback(loop.update, 100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment