Using Bokeh with Pweave

Pweave can capture Bokeh plots with the help of few utility functions.


Call this once in a Pweave document to include correct headers for Bokeh. Analogous to Bokeh’s output_notebook[source]

Include a Bokeh figure in Pweave document. Use This instead of Provides html output.

Parameters:plotbokeh.plotting.figure plot to include in output.

Here is a simple example:

from bokeh.plotting import figure
from pweave.bokeh import output_pweave, show


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)