-
Notifications
You must be signed in to change notification settings - Fork 627
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
Get embed_notebook() working inside nteract #768
Comments
For those implementing this nteract accepts a payload when in the R kernel with mimetype library(IRdisplay)
data <- list(list(x=c(1999, 2000, 2001, 2002), y=c(10, 15, 13, 17), type='scatter'))
figure <- list(data=data)
mimebundle <- list('application/vnd.plotly.v1+json'=figure)
#mimebundle[[]] <- figure
IRdisplay::publish_mimebundle(mimebundle) It assumes the Plotly figure from the Plotly JSON chart spec. Result: |
I would like to take a stab at this |
How do I start with the issue? |
Within embed_notebook you'll want to use |
I was surprised to find that Jupyter Notebooks appear to now have "native" support for all htmlwidgets, which should make a lot of folks happy, and removes any need for a I'm guessing the notebook somehow knows to call PS. @rgbkrk's suggested approach above wouldn't lead to first-class support for a couple reasons (1) The R package has an extra layer of JavaScript that plotly.js doesn't know about -- meaning some R specific functionality (such as the linked views stuff) wouldn't work. @rgbkrk, I'd be happy to elaborate/discuss anything further to help nteract gain first-class support for all htmlwidgets, but @flying-sheep would probably be more helpful/knowledgable on that front. If and when that happens, we should probably deprecate |
That's fine, it can keep on embedding HTML on the page. Does it require
nteract's is at least namespaced, there is no global plotly object on the page. The bundled version allows for straight plotly spec -> render using jupyter's mimetype setup. I'll upgrade my IRKernel setup to make sure I'm up to date and try this out. |
jep, that’s how I designed the IRkernel display system:
repr is explicitly designed not to be tied to IRkernel, so if anything wants to define a rich display/render system based on it, please go ahead! |
things unrelated to above exposition:
|
For those interested, with #859, one can now embed any (local) R plotly graph in nteract via As it turns out, the problem is related to the fact that nteract doesn't wrap the resulting HTML in an iframe (but Jupyter does)... Before officially closing this issue, it'd be nice to have a mechanism to tip off nteract users that they need to use |
Jupyter doesn't put HTML in iframes unless instructed to. Everything has global access across the entire page. I actually wish that all HTML outputs were in null origin iframes. There is no way to detect if an R session is running inside nteract, the jupyter notebook, or any other frontend (at least, not without doing JS/frontend fingerprinting...) |
embed_notebook()
currently doesn't work out-of-the-box in nteractHere's a screenshot of what you see currently:
Here's a workaround currently being proposed for plotly.py on the Python side:
plotly/plotly.py#562 (comment)
The text was updated successfully, but these errors were encountered: