☰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

Remove old plots to embed new ones

Community Supportbrowserbokehjswebsitebokeh
sdomingobasora
sdomingobasora

Hi,

I’m having an issue removing Bokeh plots.

My web app has a number of buttons. When any button is pressed, I do the following:

  • fetch an API endpoint that returns a JSON Bokeh plot, made with bokeh.embed.json_item()
  • remove all contents of a div with id “plot” where I am going to embed the plot
  • embed it via Bokeh.embed.embed_item() to the div (all buttons embed to the same div)

The second step is where I have the issue. With my limited knowledge I tried to simply document.getElementById("plot").innerHTML = "" so that I can embed new plots there. This does clean the div but when Bokeh.embed.embed_item() is called again, Bokeh embeds all the plots that have been embedded prior to that, and I end up with 10 plots in the same div.

What am I missing / how can I reset this Bokeh ‘memory’ so that I can embed the new plot without the old ones?

Thanks

⌁   Link to post

End of archived discussion · Replies are disabled