Skip to content

embed_notebook() no longer working #1138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
neverMull opened this issue Oct 16, 2017 · 8 comments
Closed

embed_notebook() no longer working #1138

neverMull opened this issue Oct 16, 2017 · 8 comments

Comments

@neverMull
Copy link

I have been using the embed_notebook() function to embed plotly graphs into my Jupyter notebooks. Today I noticed that the embed_notebook function only returns white space. However, I can still graph the plotly object outside of the embed_notebook function.

If anyone could either help me fix this problem or give me an alternative for embedding plotly objects in Jupyter notebooks, I would greatly appreciate it.

@bcdunbar
Copy link

bcdunbar commented Nov 6, 2017

Specifically, embed_notebook currently doesn't work in Chrome and Edge/IE browsers but works in Firefox. Additionally, it still functions as expected in nteract.

@bcdunbar
Copy link

bcdunbar commented Nov 7, 2017

looks like embed_notebook's function changed #768, @knowitallism you should be able to still use embed_notebook in version 4.5.6 .

require(devtools)
install_version("plotly", version = "4.5.6", repos = "http://cran.us.r-project.org")

@cpsievert
Copy link
Collaborator

cpsievert commented Nov 7, 2017

Try printing the plotly object instead of using embed_notebook() at all (e.g., do plot_ly() instead of embed_notebook(plot_ly())). That should work in a Jupyter notebook with the latest version of plotly:

docker run -p 8888:8888 cpsievert/r-notebook-plotly ipython notebook

PS. embed_notebook() is really only for nteract notebooks (at least at the moment). Maybe we should rename it...

@bcdunbar
Copy link

bcdunbar commented Nov 7, 2017

Yeah, I think there is some confusion about when/where to use embed_notebook. Oddly, it still works in FF.

Currently, plot_ly() only works in Chrome, it freezes or produces nothing in FF and IE/Edge.

@neverMull
Copy link
Author

Hi, sorry, I meant to reply back to this thread earlier. Yes, the problem is specific to Edge/IE and Chrome. With Edge, the problem seems to be that Edge/IE simply don't support data URIs for security reasons. Unfortunately, I'm unclear why this stopped working in Chrome recently. It still works with Firefox and Safari, though.

cpsievert, printing a plotly object still works in Chrome. Unfortunately, having plotly objects outside of an iframe creates problems when converting a jupyter notebook to html. So far, I have been saving plotly objects as separate html files, then embedding them inside of iframes. This is probably what I should have been doing anyway, since most browsers put limits on data URIs.

I realize that my problem is very niche, since not many people use jupyter to blog. However, the plotly documentation could be more detailed with respect to plotly and jupyter.

bcdunbar, thank you for your help. I will try downgrading my version of plotly later today, and report if your solution works.

@dchen71
Copy link

dchen71 commented Jan 31, 2018

Just an update from my end, embed notebook doesn't work on chrome v63 but does work on firefox v58. I am using 4.7.1.9000 and specifically trying to export HTML from the R kernel. Although it does work, it is extremely memory intensive for some reason.

library(plotly)
data(iris)
plot_ly(iris, x = ~Sepal.Length, y = ~Sepal.Width, color = ~Species) %>% embed_notebook

That plot seems to be using 3gb of my memory.

@cpsievert
Copy link
Collaborator

@knowitallism @dchen71 could you report your version of pandoc (if you upgrade to pandoc >2.0 it may fix your issues)?

@cpsievert
Copy link
Collaborator

I think these issues have been mostly resolved in recent versions of Jupyter. And note that using embed_notebook() is not necessarily in Jupyter, just other notebook environments that don't have a dedicated print method for htmlwidgets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants