0

I welcome instructions to do this either with Jupyter Notebook or Jupyter Lab.

My intent for learning purposes, is to download and open various notebooks from GitHub, and open new notebooks to replicate the original notebook from GitHub.

I could simply switch back-and-forth from one notebook to the other to achieve my goal. But, it would be a lot easier if I could have both notebooks opened vertically in two separate windows. Is there an easy way to do some sort of split-screen viewing?

Sympa
  • 125
  • 1
  • 1
  • 16

1 Answers1

2

You can do this out of the box in JupyterLab by opening both notebooks and then dragging one of the tabs to the right side of the screen. You can’t do this in the legacy jupyter notebook viewer - it needs to be jupyter lab.

See the jupyterlab docs on the interface for more info.

Michael Delgado
  • 13,789
  • 3
  • 29
  • 54
  • 1
    Yes, you can try JupyterLab without installing anything by going [here](https://github.com/binder-examples/jupyterlab) and click `launch binder` button. A temporary session will spin up. Open a notebook and use `!curl -OL` followed by the URL address of the **raw** code of the notebook on Github. (Or open a terminal and use same command without an exclamation point.) Repeat for another. Left-click and hold on the tab where the name of the notebook is displayed and drag the second one to a side of the first one. Release when you see highlight occupy the space to the side of the notebook. – Wayne Apr 08 '22 at 15:19
  • 1
    You should have two side-by-side now. In fact, in JupyterLab you can open two views **of the same notebook** like this which makes moving large sections around within a single notebook much easier. Or makes building one from parts of another much easier, which is closely related to your goal. Also, it will soon be much easier to get the notebook into JupyterLab from Github, see [here](https://discourse.jupyter.org/t/jupyterlab-3-3-0-is-released/13231#open-urls-7). You can install most packages (not all) in the session with `%pip install ` or `%conda install `. – Wayne Apr 08 '22 at 15:23
  • 1
    If you make anything useful make sure to download it back to your local system BECAUSE SESSIONS ARE TEMPORARY AND TIMEOUT AFTER 10 MINUTES of inactivity/a few hours. – Wayne Apr 08 '22 at 15:24
  • 1
    or you can just install jupyterlab :) – Michael Delgado Apr 08 '22 at 16:29
  • 1
    @Sympa, [this youtube video](https://www.youtube.com/watch?v=87ALbxm1Y3I) illustrates viewing same notebook side-by-side; however, you can do much the same with two different notebooks. (That's an older version of JupyterLab in the video but the steps are still similar.) – Wayne Apr 08 '22 at 16:57
  • Following your excellent instructions, I often get my notebooks in a stacked formation (top and bottom of the screen), instead of side-by-side. How can I control the visual display so I can get side-by-side? – Sympa Apr 11 '22 at 17:05
  • when you're dragging your notebook tab, you should see a blue pane showing the portion of the screen you are dragging to. Make sure you're hovering over the right side of the screen, roughly in the middle vertically, with the blue preview pane showing a vertical split. to return a tab to another tab group, drag it into the center of that group. – Michael Delgado Apr 11 '22 at 19:33