Adding html plot to a post
bluenex opened this issue · 0 comments
bluenex commented
How to add interactive lightning-viz plot to a post
Get html and js of a plot
Because a single html file for a plot is pretty big (1.5-2 MB) we will separate it into html and js.
From tuple_code:
js = viz.load_embed()
base = viz._htmlWhat we need to do more with js and base from snippet above:
- Add quote to
idof obj in base. (see detail in tuplecode/manee/ipynb) - Add a link to generated
jsfile (very big) intohtmlfile (small).- However, we can't hotlink directly to GitHub so we need rawgit.
After you run the last cell of manee ipynb in tuplecode, you get plot.html and plot.js.
Copy html of plot
Then copy plot.html to _plots folder inside _posts in tupleblog.
Include plot into a post
Use include_relative for this:
<center>{% include_relative _plots/example_plot.html %}</center>