Working in the Notebook

Inline Plots

To display Bokeh plots inline in an Jupyter notebook, use the output_notebook() function from bokeh.io instead of (or in addition to) the output_file() function we have seen previously. No other modifications are required. You can see an example below:

../../_images/notebook_inline.png

Note

As a convenience, output_notebook() is also importable from the bokeh.charts and bokeh.plotting modules.

Jupyter Interactors

It is possible to drive updates to Bokeh plots using Jupyter notebook widgets, known as interactors. The key doing this is the push_notebook() function. This function allows you to update document data and properties in the notebook, so that any plots, etc are made to update. A common use of push_notebook() is in an update callback for interactors. An example is shown below:

Warning

Currently, push_notebook always updates only the *last shown object*.

../../_images/notebook_interactors.png