Useful jupyter notebook tips & plugins / collapsible sections

I was wondering how Jeremy was able to use section folding in his notebooks. I didn’t find anything via my searches in the forum, only to find out after googling and finding the answer myself that there actually already was an answer here. Just not findable with searchwords I used and only in the 2017 edition, so for future students maybe this helps.

There is an answer here already for using conda and installing the single collapsible headers extetion:

The below lets you install a nice graphical interface for configuring this and other extentions/plugins from within the notebooks, some very useful:

pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
jupyter nbextensions_configurator enable --user

This gives you a menu for easily activating and deactivating extentions from within the main (file explorer) interface:

#search words for future reference: folding, collapse, collapsible, collapsable

22 Likes

In case you are also annoyed by jupyter notebooks standard fixed screen width and want to make full use of your HD screen for wide tables and more plotting space, this helps (and you don’t need to mess with config files):

Put this is any cell and execute. Voila, the cell sizes are full width:

from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))

Thanks to this:

btw: any valid css will do, so e.g. for screencasting you can leave some space for the video on the right using { width:100%; padding-right:300px !important; }

4 Likes