☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Update image data in Bokeh plot in Notebook

Community Support
Matthew_Rocklin
Matthew_Rocklin

I’m trying to rapidly update image data in a Bokeh figure in the notebook.

I make a figure and ColumnDataSouce like so

from bokeh.plotting import ColumnDataSource, figure, output_notebook, show

output_notebook()

import numpy as np
img = np.random.random((1000, 1000))

fig = figure(title="foo")
source = ColumnDataSource({'value': [img]})
fig.image('value', source=source, x=0, y=0, dw=64, dh=64)
show(fig)

But then when I update the ColumnDataSource my output cell doesn’t change

source.data.update({"value": [np.ones((1000, 1000))]})

If I show the figure again then I get a new output cell with the appropriate updates, but I would ideally like to just keep pushing to the same output cell.

Any tips?

⌁   Link to post
Matthew_Rocklin
Matthew_Rocklin

Thanks Bryan!

OK, I have this working in the classic notebook with the following changes:

...

handle = show(fig, notebook_handle=True)
...

push_notebook(handle=handle)

However it doesn’t seem to update in JupyterLab. Looking through these docs I make sure that I have the Bokeh JupyterLab extension installed

(dev) ngvpn01-171-128:~ mrocklin$ jupyter labextension install @bokeh/jupyter_bokeh
Building jupyterlab assets (build:dev:minimize)

But still things don’t seem to update well.

⌁   Link to post
Bryan
Bryan

@mrocklin I just tested the example notebooks with Bokeh 1.4.0 and the latest extension and they are functioning as expected. Is your problem with only your code, or do you have issues with the linked notebooks as well?

⌁   Link to post

End of archived discussion · Replies are disabled