I have a jupyter notebook running an R kernel and containing plotly figures, e.g.:
library(plotly)
x = c(1,2,3,4,5)
y = c(5,6,7,8,9)
fig = plot_ly(x=x, y=y, type='scatter', mode='markers')
fig
Everything looks good when running the notebook, but when using nbconvert:
$ jupyter nbconvert myNotebook.ipynb --to html --execute
I get an HTML file where the figures are not rendered at all. This does not happen when using plotly in python.
I tried explicitly displaying the figure, like this:
library(plotly)
library(IRdisplay)
x = c(1,2,3,4,5)
y = c(5,6,7,8,9)
fig = plot_ly(x=x, y=y, type='scatter', mode='markers')
display(fig)
but the same result was obtained.
Apparently there has been some github talk back in 2020, but I couldn't find any solution.
Anybody can help with resolving this or suggesting some workaround? Maybe even exporting to static figures?
Thanks!
Just in case someone gets here in the future - I found a workaround using R markdown. It goes something like this:
I have no idea why this works, but it does! plotly figures are rendered.