Bokeh plots and Kyso

Use this snippet to make bokeh plots work seamlessly in Jupyter and Kyso.

To make bokeh plots work inside Jupyter and render in Kyso, we will save the plot to a virtual html file and show it

from bokeh.plotting import figure, output_file, save
from IPython.display import IFrame
from IPython.core.display import display, HTML
import tempfile
def bokeh_show(plot):
tmp_output_filename = tempfile.NamedTemporaryFile(suffix='.html').name
f = open(tmp_output_filename, "r")

Then we can use this function bokeh_show to show any plots we create

p = figure(title="Bokeh test", plot_width=300, plot_height=300)[1, 2], [3, 4])