Embedding plot to web page using rbokeh

468 views Asked by At

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

There are 1 answers

0
en1 On BEST ANSWER

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.