Experiments with Bokeh

Intro

This is an example of how to use bokeh to generate HTML file with interactive charts.

Code

# Python code to generate the html for graphs
from bokeh.io import output_file, show, output_notebook
from bokeh.layouts import column, row, gridplot
from bokeh.plotting import figure
from bokeh.resources import CDN
from bokeh.embed import file_html

# Direct output to a file
output_file("layout.html")

# Define variables
x = list(range(11))
y0 = x
y1 = [10 - i for i in x]
y2 = [abs(i - 5) for i in x]

# Create three plots
s1 = figure(plot_width=250, plot_height=250, background_fill_color="#fafafa")
s1.circle(x, y0, size=12, color="#53777a", alpha=0.8)

s2 = figure(plot_width=250, plot_height=250, background_fill_color="#fafafa")
s2.triangle(x, y1, size=12, color="#c02942", alpha=0.8)

s3 = figure(plot_width=250, plot_height=250, background_fill_color="#fafafa")
s3.square(x, y2, size=12, color="#d95b43", alpha=0.8)

# Add plots to the column and direct the output to file
html = file_html(column(s1, s2, s3), CDN, "Test Layout")
                            

Conclusion

Bokeh can be used to create standalone html files with interactive charts.

Result