In Jupyter Notebook you can toggle the cell output by going into command mode and pressing "O". This command does not work on Jupyter Lab, and I don't see an option to add it. Is there a way to do this, even if it means writing the code for the command?
Asked
Active
Viewed 3,258 times
3
-
Possible duplicate of [Jupyter Notebook: command for hide the output of a cell?](https://stackoverflow.com/questions/37154329/jupyter-notebook-command-for-hide-the-output-of-a-cell) – Arkady. A Jul 13 '19 at 16:21
-
@Arkady.A Looks like it to me. – Brian Keith Mar 04 '20 at 19:02
-
1JupyterLab is different than the classic notebook interface covered at the possible duplicate. – Wayne Mar 04 '20 at 21:43
-
@Wayne True but the solution of adding ; at the end of an output you want to suppress also works in lab – Brian Keith Mar 04 '20 at 21:49
3 Answers
1
In Jupyter Notebook you could easily just double click on the cell output to hide it.
This doesn't appear to work in Labs.
Labs has functionality to set keyboard shortcuts.
Settings>Adv Settings> Keyboard Shortcuts You can then add your own shortcut. This example uses "H".
{ "shortcuts": [
//First you can optionally make room for your new hotkey if it is taken.
// {
// "command": "imageviewer:flip-horizontal",
// "keys": [
// "H"
// ],
// "selector": ".jp-ImageViewer",
// "disabled": true
// },
// Then assign a new hotkey
{
"command": "notebook:hide-cell-outputs",
"keys": [
"H"
],
"selector": ".jp-Notebook:focus",
"disabled": false
}
]
}

d0m1n1c
- 11
- 1
-
Thanks ! Works well for me (version 3.1.14). Some notes: to open this file "settings" -> "advanced settings" -> "Keyboard Shortcuts". I noticed that single letter shortcuts key **must** be in uppercase in this config file (if not they are ignored), but their usage is **lowercase** only. Weired – Bruno Duyé Oct 05 '21 at 13:49
0
As Arkady said, this looks like a duplicate from this post. Note, you can also do this in the sidebar if you don't want to code it.

Brian Keith
- 255
- 1
- 3
- 13
-
I'd also add that these abilities are presently available under the `View` menu in JupyterLab. There is `Collapse` and `Expand` sections for selected code, selected output, all code, or all outputs. – Wayne Mar 04 '20 at 21:46
0
Click on the blue vertical bar to the left of the output or code cell to hide/toggle them. Found this when I accidentally clicked on it :)

betha manjunath
- 1
- 1