import numpy as np from bokeh.plotting import figure from bokeh.models import ColumnDataSource class Plot1D: def __init__(self): data = { "x": [], "y": [] } self.source = source = ColumnDataSource(data=data) self.fig = fig = figure() fig.line(x="x", y="y", source=source) fig.circle(x="x", y="y", source=source) def set(self, y): x = np.arange(len(y)) data = { "x": x, "y": y } self.source.data.update(data)