Files
kabuki/plot1d.py
2021-05-20 23:44:43 +02:00

34 lines
557 B
Python

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)