24

I'm using Jupyterlab for my datascience studies. Everything is Ok with this new tool, but some process as GridSearchCV has long logs and this results pollutes the notebook. There is a way to active scroll bars to avoid this like in traditional Jupyter notebooks?

Juliano Oliveira
  • 868
  • 1
  • 9
  • 29

3 Answers3

43

You have a few options:

  1. Right click on cell's output -> "Enable Scrolling for Outputs". This will limit output view's height and enable scrolling, like in the classic notebook.
  2. Right click on cell's output -> "Create New Output View". This will create a separate scrollable view and dock it to the bottom of the screen. You can then collapse the view in the main window so it doesn't clutter the notebook.
aldanor
  • 3,371
  • 2
  • 26
  • 26
  • 9
    Is there a way to make it as the default behaviour? There is a related discussion [here](https://github.com/jupyterlab/jupyterlab/issues/4028). Unfortunately rerunning such cells will change the behaviour again. – BND Feb 15 '19 at 14:03
  • 1
    @BND Please see my answer. It uses an extension called Stylus to activate scrolling when the output is too large. – Corey Levinson Oct 04 '19 at 15:32
  • 1
    Any updates on whether it has been added to default bahavior? – haneulkim Nov 02 '22 at 22:54
11

there is an automatic way to do this. First, you must install the addon "Stylus" (available on both Chrome and Firefox). This addon allows you to write custom CSS on websites.

Next, go to your JupyterLab page at localhost:8888/lab and click on the Stylus icon in the top right, and click "Write style for this URL"

Under the URL, i changed localhost to localhost:8888/lab. Then, I copied in this script by user Buckle2000 from Github (https://github.com/jupyterlab/jupyterlab/issues/4028#issuecomment-446820575)

.jp-OutputArea-child {
    max-height: 15em;
}

.jp-OutputArea-child .jp-OutputArea-output {
    overflow: auto;
}

Then click the Save button, and you should be good to go. I believe you can change the number 15 to make it activate for different heights. It should look like this:

JupyterLab Automatic Scrolling Custom CSS

Corey Levinson
  • 1,553
  • 17
  • 25
1

If you are not interested in the output, you can use cell magic capture. It captures cell output and doesn't display them.

Zoe
  • 27,060
  • 21
  • 118
  • 148
BND
  • 612
  • 1
  • 13
  • 23