The Bokeh
pane allows displaying any displayable Bokeh model inside a Panel app. Since Panel is built on Bokeh internally, the Bokeh model is simply inserted into the plot. Since Bokeh models are ordinarily only displayed once, some Panel-related functionality such as syncing multiple views of the same model may not work. Nonetheless this pane type is very useful for combining raw Bokeh code with the higher-level Panel API.
When working in a notebook any changes to a Bokeh objects may not be synced automatically requiring an explicit call to pn.state.push_notebook
with the Panel component containing the Bokeh object.
Parameters:
For the theme
parameter, see the bokeh themes docs.
object
(bokeh.layouts.LayoutDOM): The Bokeh model to be displayedtheme
(bokeh.themes.Theme): The Bokeh theme to apply
To update a plot with a live server, we can simply modify the underlying model. If we are working in a Jupyter notebook we also have to call the pn.io.push_notebook
helper function on the component or explicitly trigger an event with bokeh_pane.param.trigger('object')
:
Alternatively the model may also be replaced entirely, in a live server:
The other nice feature when using Panel to render bokeh objects is that callbacks will work just like they would on the server. So you can simply wrap your existing bokeh app in Panel and it will render and work out of the box both in the notebook and when served as a standalone app:
Controls
The Bokeh
pane exposes a number of options which can be changed from both Python and Javascript. Try out the effect of these parameters interactively: