1π
β
In more recent versions of Bokeh (probably since 0.11
), the components
function can accept multiple plots at once, and for this use case that is in fact necessary. The reason for this is that different calls to components
return scripts that use distinct different Document
objects. But if you intend for objects to be linked in any way, those objects all must be in the same Document
. So in your case, something like:
components((p1, p2))
# returns (script, (div1, div2))
is what you want. The single script that gets returned will replace both divs that are returned.
There are other ways to call components
(e.g. with a dict
of plots, etc). Please see the project documentation for more information.
π€bigreddot
Source:stackexchange.com