The Jupyter Notebook interface¶
There are a few sections of the Notebook interface that will be useful to know your way around:
The jupyterhub logo. Clicking on this takes you back to your Notebook Dashboard.
The name of your Notebook. Please do not leave this as
Untitled.ipynb. You will thank me later.
Information about when this Notebook was last saved. (or, in Jupyter parlance, when a checkpoint was last created.). You can force your Notebook to save using:
⌘S (Mac) / alt+S (Windows)
Save and Checkpoint.
Logout of the JupyterHub server.
Open your Control Panel. You almost certainly will not need to go in here.
The Notebook Menubar. This contains:
File: File operations, e.g. create a new Notebook, open an existing Notebook, Copy your current Notebook, Save, etc.
Edit: Manipulating cells
View: Options for what appears on your screen, and for toggling various aspects on and off.
Cell: Executing one of more cells, and manipulating the output of cells.
Kernel: Stop, start, etc. the kernel.
Widgets: Managing plugins and extensions that you might have installed.
Help: Access to the built-in help.
Particularly useful items here are
User Interface Tourand
The Notebook Toolbar This contains buttons for the most common actions for working with Notebooks. Hovering you mouse over each button will show you a popup with some information about the associated action.
The currently selected cell.
Indicates whether a cell has run or not, and for cells that have been run, the order they ran in.
The text area for the code cell. This is where you can type in Pyton code to then run.
The body of the notebook is made up of cells. When you open a new notebook it will contain only one empty cell. In the screenshots so far, the cell is the grey box with
In [ ]: to the left. There are two main types of cell that you will need to know about.
A code cell contains code that can be executed. When the code is run, the notebook displays any output generated by that code below the corresponding cell.
A code cell with some Python code. &lqduo;Running” this cell executes the code in the cell. The output produced by running the code is displayed underneath. In this case I have used the
print() function to show the result of calculating
A markdown cell contains text formatted using Markdown, which is a lightweight markup language for writing html documents. When a markdown cell is run, the markdown is formatted to html, with the formatted text then shown in place of the cell.
A markdown cell being edited.
Executing the cell formats the contents.
Cells can be switched between code and markdown using the
Cell Type menu options:
A cell is marked as active if it is highlighted. The colour of the highlight depends on whether you are in command mode or edit mode
Command mode is indicated by a blue highlight. When you are in command mode you can use keyboard shortcuts to cut, paste, and move cells, etc. You can see all the keyboard shortcuts under
If you are in command mode then pressing
Enter or clicking in the input text area of a cell will switch you to edit mode. Edit mode is indicated by a green highlight, and a pencil icon in the top right of the Notebook window.
Typing now inserts text into the currently active cell:
To get out of Edit Mode, and back into Command Mode, press
Esc or click outside the text entry area.