Created
September 26, 2019 14:58
-
-
Save macloo/f5eba0218d7f7b368d316f891ecc7f50 to your computer and use it in GitHub Desktop.
Export HTML and JavaScript of a Bokeh chart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assumes you already made a chart with Bokeh and it is assigned to a variable, chart1 | |
# added code for exporting the chart as HTML + JS | |
# https://bokeh.pydata.org/en/latest/docs/user_guide/embed.html | |
from bokeh.plotting import figure | |
from bokeh.resources import CDN | |
from bokeh.embed import file_html | |
# create a complete HTML file | |
html = file_html(chart1, CDN, "bokeh_chart01") | |
# regular python to write the file | |
newfile = open('bokeh_chart01.html', 'w') | |
newfile.write(html) | |
newfile.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment