Embedding (high quality interactive) plots and data into HTML documents with Bokeh
I am trying to learn a bit of Bokeh to embed plots and data into HTML documents. It looks simple enough, yet the results are pretty impressive. The example below, for instance (which is verbatim from bokeh’s own documentation), took a mere few lines of code in python
.
Start with a few calls:
To generate the plot, issue these simple numpy
commands:
And that’s it! Generate the needed code to be embedded in the web page by issuing components
:
Note, for example, the output stored in the variable plot_div
:
Now, in any webpage where you’d like to embed this plot, start by loading BokehJS
.
Add to that preamble the script from the output of plot_script
above. Whenever you’d like to embed the plot, simply drop the contents of plot_div
, and you are done!