使用 rbokeh 将绘图嵌入网页

Embedding plot to web page using rbokeh

我使用 rbokeh 在 R 中创建了一个图,我想将其转换为 HTML/Javascript 以便将其嵌入到网页中。我目前能够通过 Python 上的 mpld3 实现这一点(而且我知道 python 上的散景也能做到这一点)但我希望能够通过 R 中的 rbokeh 实现这一点。所以基本上我'我正在寻找类似于 Python 的 mpld3.fig_to_html() 的内容,例如:

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

或者使用Python的散景模块:embed.autoload_static()

rbokeh 图可以转换为 html/JavaScript 代码吗?

非常感谢。

到目前为止,saveWidget 似乎最接近我想要的,所以感谢 hrbrmstr。我想避免每次将图形导出到 html 时都必须从磁盘读取和写入,但这还不可能。