Access canvas of a figure via JS

I am trying to access the canvas of a figure via JS but that does not seem to be possible (I am probably overlooking something).
Sofar I am using const canvas_arr = document.getElementsByTagName('canvas'); which returns all canvas. However with that I can’t really match a figure and its canvas, as the canvas has no ID.
Anyone got an idea how to get the canvas elements of a figure?

Not missing an anything, this is just not intended usage. The intent is that Bokeh controls the canvas. You might be able to do something like add a unique css_classes to the plot model, then find the canvas element that is contained within the div the has that class added. Really, though if you want to access the canvas, the better options are:

2 Likes