Embedding plot to web page using rbokeh

懵懂的女人 提交于 2019-12-10 11:51:44

问题


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:


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.



来源:https://stackoverflow.com/questions/30947668/embedding-plot-to-web-page-using-rbokeh

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!