Files
kabuki/plot2d.py
2021-06-02 16:44:42 +02:00

28 lines
526 B
Python

import numpy as np
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource
from buki import Object
class Plot2D(Object):
def __init__(self, name=None):
data = {
"image": [np.zeros((1, 1))]
}
self.source = source = ColumnDataSource(data=data)
fig = figure(name=name)
fig.image(source=source, x=0, y=0, dw=1, dh=1, palette="Spectral11")
super().__init__(fig)
def set(self, image):
self.source.data.update(image=[image])