Interactive plot using Bokeh - first step -


The result (static image) is:

Interactive plot using Bokeh - first step -

I firstly thought that Bokeh uses matplotlib. We generate figure using matplotlib then convert the figure to the Bokeh compatible. However, it seems Bokeh works stand alone without matplotlib (is it true?) Anyway, let's check whether Bokeh works in my environment or not.

See also:

Python Matplotlib Tips: Interactive figure with interactive legend using Python, matplotlib.pyplot and mpld3

This page shows how to plot data in interactive figure using python, matplotlib.pyplot and mpld3. A interactive legend is added to the figure.

Python Matplotlib Tips: Plotly first time operation check: copy and past of sample code (life time expectancy)plotly-logomark

Tips for drawing efficient figures using python matplotlib pyplot. You can brush up them by adding some additional options and settings.


This code is based on the following web pages:

In [1]:
import platform
print('python: '+platform.python_version())
python: 3.6.3

Load Bokeh library

In [2]:
from bokeh.plotting import figure, output_file, show
from bokeh.io import output_notebook
output_notebook()
Loading BokehJS ...
In [3]:
p = figure()
p.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=2)
show(p)