added 1D example
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user