Using Bokeh with Pweave¶
Pweave can capture Bokeh plots with the help of few utility functions.
-
pweave.bokeh.
output_pweave
()[source]¶ Call this once in a Pweave document to include correct headers for Bokeh. Analogous to Bokeh’s output_notebook
-
pweave.bokeh.
show
(plot)[source]¶ Include a Bokeh figure in Pweave document. Use This instead of
bokeh.plotting.show
. Provides html output.Parameters: plot – bokeh.plotting.figure
plot to include in output.
Here is a simple example:
```python
from bokeh.plotting import figure
from pweave.bokeh import output_pweave, show
output_pweave()
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]
p = figure(title="simple line example", x_axis_label='x', y_axis_label='y')
p.line(x, y, legend="Temp.", line_width=2)
show(p)
```