Embedding plot to web page using rbokeh

2019-06-14 01:24发布

I have created a plot in R using rbokeh and I want to convert it to HTML/Javascript in order to embed it inside a web page. I'm currently able to achieve this with mpld3 on Python (and I know that bokeh on python does it too) but I want to be able to do this with rbokeh in R. So basically I'm looking for something similar to Python's mpld3.fig_to_html(), e.g:

fig, ax = plt.subplots()
ax.p1 = plt.bar(...)  
html = mpld3.fig_to_html(fig) # <- converts the plot to html/javascript!
print html   # prints out the html/javascript code as text

Or using Python's bokeh module: embed.autoload_static()

Can rbokeh plots be converted to html/JavaScript code?

Many thanks in advance.

1条回答
小情绪 Triste *
2楼-- · 2019-06-14 02:11

It appears that, to date, saveWidget is the closest to what I want, so thanks hrbrmstr. I wanted to avoid having to read and write from the disk every time a graph is exported to html but it's not possible yet.

查看更多
登录 后发表回答