Best way to use Javascript inside Jupyter?

106 views
Skip to first unread message

Jeffrey Wong

unread,
Jun 10, 2017, 2:18:45 PM6/10/17
to Project Jupyter
Hi,

I am a regular Rstudio/RMarkdown user on the transition to using Jupyter instead. There are two tools that I really like to use in RMarkdown: 


In RMarkdown, it is mainstream to use datatable to pretty print a data frame, and to use plotly for interactive plots. When a Rmd file is knit to HTML, a single .html file is generated which contains all the necessary javascript to still power datatable and plotly.

When I run a Jupyter server, I can still use the R kernel and use datatable and plotly. However, when I go to download the notebook as .html (for example to archive this notebook), I don't get the javascript needed to run datatable/plotly. Are there any extensions that would enable something similar to RMarkdown + knit, where I can still use the javascript tools outside of the notebook server?

Thanks 

Brian Granger

unread,
Jun 10, 2017, 9:18:47 PM6/10/17
to Project Jupyter
Jeff,

Hi! This is an area we are actively working on. Some points on this front:

* JupyterLab will soon have support for pretty-rendering large (>1
million row/col) dataframes, based on phosphorjs
(https://github.com/phosphorjs/phosphor/pull/283) - see attached
screenshot.
* We have pretty much decided to begin shipping the JS for plotly,
vega and vega-lite in JupyterLab and the classic notebook.
* The JavaScript for JupyterLab and these renderers is now a clean set
of npm packages - it should be pretty simple to bundle all the Js
needed to render these things into HTML files. We are still finishing
up the JS APIs for all this, but I am hoping this will be possible
later this year.
* JupyterLab will also have support for standalone markdown files that
can be run in jupyter kernels and rendered. Some of that is working in
JupyterLab now, full rendering later this year.

In summary, we are quickly getting there to address your points, but
will be a bit more time before the full experience is there.
RStudio/RMarkdown offers an extremely nice and integrated experience
in this area - they have set a high bar ;-)

Cheers,

Brian
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+u...@googlegroups.com.
> To post to this group, send email to jup...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/f28aea34-af88-4226-a3ad-3427591c1326%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgra...@calpoly.edu and elli...@gmail.com
Screen Shot 2017-06-10 at 6.15.28 PM.png

Matthias Bussonnier

unread,
Jun 11, 2017, 1:21:23 PM6/11/17
to jup...@googlegroups.com
Just to extend onto what Brian said, JupyterLab will make the editing
experience much better.

> When I run a Jupyter server, I can still use the R kernel and use datatable and plotly. However, when I go to download the notebook as .html (for example to archive this notebook), I don't get the javascript needed to run datatable/plotly. Are there any extensions that would enable something similar to RMarkdown + knit, where I can still use the javascript tools outside of the notebook server?

For this we need to hook into nbconvert (likely). I don't know how
plot.ly/datatable inject javascript into the live notebook, but his
way may not register itself correctly to be embeded into the exported
html document.

The other possibility is opening the html file by double clicking may
restrict the javascript execution. So opening a local server may make
the file work better. Unfortunately is this is the reason why
plot.ly/datatable do not work there is not much we can do. it's
probably the case as plot.ly works on nbviewer.ipython.org, and that's
"just" a custom theme on nbconvert.

We'll see what we can do for that.

Thanks !
--
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CAH4pYpQ3dSAVSV8ufd-9-VgD_7%2B%2BbD-MAOFkn2fkM-M-GHAeaQ%40mail.gmail.com.

Jeffrey Wong

unread,
Jun 11, 2017, 3:08:07 PM6/11/17
to Project Jupyter
Matthias, Brian,

That's great to hear there is active dev on this. I would like to be able to contribute, but I don't know the code bases well. If you need feedback from a real user I would like to be able to help
Reply all
Reply to author
Forward
0 new messages