I could not find any documentation on embedding bokeh plots in markdown styled documents. Is there an easy way to do this using the script and div tags that bokeh.embed.components ?
If your Markdown flavour supports <embed> tags this is possible using the .html file generated by Bokeh's output_file().
In Python:
from bokeh.plotting import figure, output_file, show
p = figure(title="example", x_axis_label='x', y_axis_label='y')
output_file("example.html")
show(p) # Needed to actually save the file
In Markdown:
<embed type="text/html" src="relative/path/to/example.html" width="600" height="400"></embed>
Note that the width and height attributes are necessary since it won't auto-size.
This method does have the minor drawback of needing to keep the plot files with the Markdown.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With