notebook/binder/example.ipynb
2022-03-19 18:07:20 +01:00

753 KiB

Welcome to Jupyter Notebook v7! 👋

Jupyter Notebook v7 is built using the same components as JupyterLab, and reuses a lot of the work from the JupyterLab community by leveraging the new prebuilt (federated) extension system.

Files 📂 and Running Sessions 🏃‍♀️

Jupyter Notebook lets you navigate the files in a separate browser tab.

Go ahead and click on the Jupyter icon in the top left corner!

image.png

It will open a new browser tab with the listing of the files on the server:

image.png

It also shows the list of running sessions and terminals in the Running tab:

image.png

Alternatively it is also possible to access this page using the command in the View menu:

image.png

Editing Files 🖊️

Jupyter Notebook also has support for editing files. Double-click on a file (or Right Click > Open) to open the editor:

image.png

image.png

Terminals 🖥️

To create a new Terminal, select File > New > Terminal in the menu:

image.png

The terminal opens in a new browser tab:

image.png

Command Palette 🎨

Jupyter Notebook includes a command palette, just like in JupyterLab.

Hit Ctrl-Shift-C or Accel-Shift-C to activate it. Or via the menu with View > Activate Command Palette:

image.png

Using the palette is very convenient and can give a significant productivity boost over time!

Themes 🌈

Since Jupyter Notebook v7 is heavily built on top of JupyterLab, it also has support for a Dark Mode! 🕶️

Go to Settings > Theme > JupyterLab Dark to select the theme:

image.png

New themes can be installed using the federated extension system. These themes will be compatible with both JupyterLab and Jupyter Notebook.

Zen Mode 😌

This is an exclusivity in Jupyter Notebook v7 😎

Activate the palette and choose Toggle Zen Mode. The interface will focus on the notebook and the notebook only!

image.png

Press Escape to exit, or re-run the Toggle Zen Mode command from the palette.

Third Party Extensions 🧩

Jupyter Notebook v7 supports third-party extensions developed for JupyterLab 3.0+, using the new distribution system. These extensions can be installed via pip.

For example the extension to enable Jupyter Widgets rendering in both JupyterLab and Jupyter Notebook can be installed using the following command (run the cell):

In [ ]:
!pip install ipywidgets

Now reload the page and resume from here. In the next section we will be able to create and use Jupyter Widgets!

Widgets

Now let's instantiate a new widget:

In [ ]:
from ipywidgets import IntSlider
slider = IntSlider()
slider
In [ ]:
slider

Rich Display

Just like in many Jupyter Frontends, Jupyter Notebook supports rich display rendering. For example:

In [ ]:
from IPython.display import Latex
Latex(r"""\begin{eqnarray}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0 
\end{eqnarray}""")

Matplotlib figures:

In [ ]:
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 10, 100)

plt.plot(x, np.sin(x))
plt.plot(x, np.cos(x))

plt.show()

Or even HTML:

In [ ]:
from IPython.display import HTML
from IPython.display import display

s = """<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>"""
h = HTML(s)
display(h)

That's it!

Hope you enjoyed the tour. If you have more question or any other issues, don't hesitate to go to the repository on GitHub!

https://github.com/jupyter/notebook