Migrating to Jupyter Lab from Jupyter Notebook
Jupyter Lab provides a whole load of advantages when compared to Jupyter Notebooks (the complete list can be accessed here). So, I recently migrated to Jupyter Lab. Migrating from one IDE/Text Editor to another is always a wobbly ride. But, there are some minor changes that can smooth this transition and they are as follows:
Adjust the Text Size
After extensively using Jupyter Notebooks, the text size in Lab might feel very small. So, change the User Settings by using the shortcut Ctrl+,
. Navigate to the Notebook
option and add the following code under Application -> User Preference
.
{
"codeCellConfig": {
"fontFamily": "DejaVu Sans Mono",
"fontSize": 14,
"lineHeight": 1.2,
"lineNumbers": true,
"lineWrap": "wordWrapColumn",
"wordWrapColumn": 100,
},
"markdownCellConfig": {
"fontFamily": "M+ 2p",
"fontSize": 16,
"lineHeight": 1.2,
},
"rawCellConfig": {
"fontFamily": "M+ 2p",
"fontSize": 16,
"lineHeight": 1.2,
}
}
This will ensure that the text size and line wrapping is active. Additionally, I have activated the display of line numbers using lineNumbers: true
, this can be deactivated by removing the line or changing it to false
.
Activating Sublime Key-bindings in Lab
As emphasized in my previous post, the Sublime key-bindings can be activated in Lab by using the jupyterlab_sublime
extension in Lab.
The following code can be used to install the extension for JupyterLab (version<3):
jupyter labextension install @ryantam626/jupyterlab_sublime
Edit: July 13, 2021
The following code can be used to install the extension for JupyterLab (version >=3):
pip install jupyterlab_sublime
Equivalent extensions for other text editors can be found here:
- Vim: jupyterlab-vim by Jacques Kvam.
- Emacs: jupyterlab-emacskeys by KPE.
Install the Plotly plugin for Lab
Plotly is arguably one of the best plotting libraries in Python. In order to visualize the plots in Lab, we need to install the Plotly extension.
The following code installs the extension (the widget installation is optional):
jupyter labextension install jupyterlab-plotly@4.14.1
jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidget@4.14.1
You can add any additional extensions as required from the extensions tab.