Jupyter Notebook: How to improve navigation experience over long page - jupyter-notebook

I would like to be able to switch rapidly from one section of my Jupyter notebook to another section, I mean within the same .ipynb file, as these files tend to get long while exploring data.
Ideally, this will be possible by marking the scrollbar of the navigator. I was thinking using a mozilla firefox add-ons, like "Scrollbar Search Highlighter" or "Content Scrollbar", but I didn't find a way to use them within the Jupyter notebook context.
Any idea to improve Jupyter notebook experience related to long page navigation?

Jupyter notebook extensions (link) come with the Table of Contents extension, which allows you to conveniently navigate over the various sections of your notebook

Make use of nbextensions. From there you can enable Table of contents which finally look like this:

Table of contents is built-in JupyterLab by default now:
https://jupyterlab.readthedocs.io/en/stable/user/toc.html
Also available as the structure tab of DataSpell and Pycharm:
https://www.jetbrains.com/help/dataspell/guided-tour-around-the-user-interface.html#tool-windows

Related

How can I display a markdown reference/cheatsheet within JupyterNotebook

I could swear that several times when working in a Jupyter Notebook, I inadvertently hit some shortcut key that popped up a markdown cheatsheet, within the Notebook window, but I cannot figure out how to access this cheatsheet intentionally, via shortcut or menu. I've searched the Jupyter Notebook docs, but I'm not finding anything.
I am able to access a Markdown guide on GitHub, in a separate page, but not the cheatsheet that appears within the Notebook, similar to the way the "command palette" opens within the Notebook, as a pop-up. The latter is much handier, as it doesn't involve jumping back and forth between browser tabs.

how to print something in a new window in jupyter notebook?

I have seen that in some IDEs, when you print something , a new window opens up.
my question is that is it possible to have the same thing for jupyter notebook ?
P.s:
It would be better if it was customizable; like being able to change the background color of the new window.
You'd want the newer generation of Jupyter interface, JupyterLab. (At least if you want this soon. I don't know what will be possible as Jupyter notebook 7 starts using more of the underlying machinery that JupyterLab uses.)
Default JupyterLab
Using default current JupyterLab, you can make a separate window for any output that you can drag around and arrange how you want. Right-click on an output cell and select from the menu 'Create New View for Output'. That will open a new window that respects the current JupyterLab theme. (There's a lot of theme adapting abilities so maybe that can provide what you need as far as background.) Once the new window is generated you can click and drag it around the JupyterLab window to arrange it relative to the notebook and then release when you have it outlined the way you want. You can try it right in your browser by clicking this link and letting the session spin up.
(This ability was covered in an answer to a similar question 'How to display Jupyterlab output in new tab?'.)
Similarly, you can have a window that keeps updating with the most recent output by using an attached console and toggling on 'Show All Kernel Activity'. When you have a notebook open, either right-click and select 'New Console for Notebook' or go under the main 'File' menu and select 'New Console for Notebook'. This will open a console and you can then right-click on the console pane and toggle on 'Show All Kernel Activity'. As you run things in the notebook, the output will show at the bottom of this window as well. Even rich output like plots and dataframe displays. You can click on the tab and drag to arrange this window as you wish in the main JupyterLAb pane. See some example images using this here and here.
Related:
It's not a separate window; however, a nice feature of JupyterLab is switching to 'View' to 'Render Side-by-Side' where the output goes to the side of the code cell and not below. Alternatively, you can modify the output cell in some ways like you could do in the classic notebook interface, see here.
Sidecar extension of JupyterLab
There's an extension called sidecar for Jupyterlab that I believe has more options. I wonder if you could combine widgets to control the background as you seek. Don't know about the layering possibilities there.
ipylab extension of JupyterLab
ipylab has even more abilities than sidecar for customization, with 'SplitPanel' and 'DockPanel'. Scroll through the examples shown to get an idea of the possibilities. There's also a 'launch binder' badge so you can try it out.
(You may also want to see Related projects listed at the bottom of ipylab's github page.)

Is there a way to keep editing cell and rendered cell open at the same time in a Jupyter Notebook?

I.e. for one cell in the notebook, the editing version and rendered version are presented side-by-side so you don't lose your place between editing and checking the rendered version. Particularly for Markdown cells.
Are there any plugins or add-ons which achieve this? Perhaps there is a hacky way to have two browser windows where one updates rendered cells in real time and the other is used for editing. I guess even something as simple as the "render cell" command being piped to a different window would do the trick.

Jupyter notebook opens slowly and extensions don't show up - [MathJax] issue

I'm trying to open a jupyter notebook and it takes a long time and I see at the bottom it's trying to load various [MathJax] extension, e.g. at the bottom left of the safari browser it says:
Loading [MathJax]/extensions/safe.js
Eventually, the notebook loads, but the extensions I used to have, don't show up (like table of contents and others)
I tried to run nbstripout with the relevant filename but it didn't change anything.
I also tried to reinstall jupyter.
I'm having the same issue with timing (but my extensions all seem to work OK). After a lot of experiments with MathJax options in the Jupyter configuration file it seems to be... not related to MathJax.
My guess is that's the last notice displayed, and it stays there while the rest of the notebook loads.
In my experiments, the time to load is directly related to the number of cells in the notebook.

Using Widgets in Google Colaboratory

Is it possible to use Jupyter Widgets in Google Colaboratory?
I followed the instructions here, both with ipyleaflet and bqplot
But I got this error message.
Failed to display Jupyter Widget of type Map.
If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean that the widgets JavaScript is still loading. If this message persists, it likely means that the widgets JavaScript library is either not installed or not enabled. See the Jupyter Widgets Documentation for setup instructions.
If you're reading this message in another frontend (for example, a static rendering on GitHub or NBViewer), it may mean that your frontend doesn't currently support widgets.
Is it possible to use these widgets? Or did I make a mistake somewhere?
Now Google Colab has its set of Widgets. See the example here.
https://colab.research.google.com/notebooks/widgets.ipynb
I haven’t compared how diffrent are they from normal Jupyter Widgets, though.
Update Feb'19
ipywidgets are supported now. You can test run
the tutorials.
It is not currently possible to use them- currently comms messages are not supported, the WidgetManager code is not loaded into outputframes, and multiple output frames on a page is not a configuration that the WidgetManager works with.
Feel free to open a bug at https://github.com/googlecolab/colabtools/issues
some libraries widgets do work including for Bokeh which has a map plotting function which you can use instead of ipyleaflet if you are wishing to use Map Visualisations in Colab:
https://colab.research.google.com/notebook#fileId=/v2/external/notebooks/charts.ipynb&scrollTo=vlOIt0zZ5uCz
You can then use their mapping function:
http://docs.bokeh.org/en/latest/docs/user_guide/geo.html
Make sure you include:
from bokeh.io import output_notebook
output_notebook()

Resources