☰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

Clear Figure

Community Support
Bryan
Bryan

Just noting that that is actually the solution I was going to propose. But it does depend, e.g. if you want to “clear” but then only to re-draw the same set of glyphs, just with different data, then you could also empty of the columns of all the ColumnDataSources of the glyphs. Bokeh is very good at updating the data of existing glyphs (even if that update is empty arrays). But if you need some entirely different plot with entirely different glyphs, then yes, just make an entirely new plot.

⌁   Link to post
Bryan
Bryan

@anoSF There are always column data sources. If you don’t create them explicity, then Bokeh creates them for you behind the scenes. A CDS drives every glyph, and it is often times very useful to create the CDS yourself, e.g. so that you can update its .data mapping. There are helpful docs here:

https://docs.bokeh.org/en/latest/docs/user_guide/basic/data.html#providing-data-as-a-columndatasource

There are lots of examples in the docs and in the GitHub repo of updating source.data to some new value to change a plot.

⌁   Link to post
anoSF
anoSF

Also is there a way to speed up when deleting figure and redrawing? Also because another example is I delete the figure and need to redraw all circles, when drawing circles, it takes a while. Thank you

⌁   Link to post
Bryan
Bryan

Updating the data, rather than deleting and re-creating the entire plot, is the way to speed things up. It also matters things like how much data are we talking about? I really should have asked for this earlier, but it’s basically impossible to speculate in detail without a complete Minimal Reproducible Example to focus the discussion.

⌁   Link to post

End of archived discussion · Replies are disabled