☰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

Removing dynamically added bokeh plot

Community Support
bokehcoder
bokehcoder

Hi, I am adding bokeh plot like this:

              const tileScript = document.querySelector("#tileScript");
              tileScript!.setAttribute("data-tile-query", resp.data);
              const script = document.createElement("script");
              script.setAttribute("id", "plotscript");
              script.src = process.env.PUBLIC_URL + "load-plot.js";
              script.async = false;
              document.body.appendChild(script);

This works great.

However when i try to remove the plot again i do like this:

                  onClick={() => {
                    const tileScript = document.querySelector("#tileScript");
                    tileScript!.removeAttribute("data-tile-query");
                    document.getElementById("plotscript")!.remove();
                  }}

I get no errors…but the plot is also not removed :frowning: What am I missing here?

⌁   Link to post

End of archived discussion · Replies are disabled