The world’s leading publication for data science, AI, and ML professionals.

5 Slides for Tips on Presentation Mode in Jupyter Notebook

A tutorial to create an HTML slideshow with Jupyter Notebook


Embedded Photo by Austin Distel on Unsplash
Embedded Photo by Austin Distel on Unsplash

Let’s Jump Into It

You’re here, you’re reading this article, and you already have Jupyter Notebook installed and ready to go.

The presentation slides option from jupyter notebook speaks for itself. This is an alternative to copy-and-pasting screen captures into other presentation software.

The first step is to enable the Slideshow option in the View > Cell Toolbar options. Just click on the Slideshow option and continue reading.

Enable Slideshow
Enable Slideshow

Each cell in the Jupyter Notebook will now have a Slide Type option in the upper-right corner.

Slideshow is Now Enabled
Slideshow is Now Enabled

An Example Notebook with Slideshow

Here’s an image of the full Jupyter Notebook that we’ll walk through next. The notebook is also available on GitHub if you’d like to follow along.

The next steps will contain the slide outputs to illustrate the results, although there will be references made to this notebook.

Image by Author
Image by Author

The Slideshow

Once you have a notebook that you’d like to send to an HTML slideshow presentation, run the following one-line command from the terminal. Since you may already have Jupyter Notebook running on your existing terminal window, you might open another terminal window to run the one-line command.

jupyter nbconvert 'Presentation Slides with Jupyter Notebook.ipynb' --to slides --post serve

The command generated and opened a file called "Presentation Slides with Jupyter Notebook.slides.html" in the browser running Jupyter Notebook.

The First Slide

The first slide has the type "Slide" and an arrow on the bottom-right corner to move on to the next slide.

The First Slide
The First Slide

The Second Slide

The second slide also has the type "Slide" but has three options in the bottom-right corner.

  • You may go back to the first slide by clicking the left arrow
  • You may go forward to the next set of main slides by clicking the right arrow, but this would skip some content since you have an available down arrow
  • Let’s click the down arrow and see what happens next
The Second Slide
The Second Slide

The Third Slide (or Third Image if You Prefer)

After clicking the down arrow above, we are now on the third image, which is of the type "Sub-Slide." This option enabled a different grouping of slides. But that’s not all that is left. There’s another down arrow option, so let’s click that again.

The Third Slide
The Third Slide

The Fourth Slide (or Fourth Image if You Prefer)

When clicking the down button this time, the Sub-Slide remained on the screen while the next Slide Type "Fragment" appeared.

Additionally, the Slide Type of "-" appeared at the bottom, as "-" will appear after the last execution on that Slide or Sub-Slide.

The Fourth Slide
The Fourth Slide

The Fifth Slide

Then when you press the right arrow, the last slide appears. That is to say, the Slide Type of "Notes" was skipped over, similar to how the Slide Type of "Skip" was skipped over at the beginning of the notebook. That’s correct- we already used the "Skip" Slide Type at the beginning, for the statement to import pandas.

The Last Slide
The Last Slide

Recap Slide Types

To recap, there are a few Slide Types for the Jupyter Notebook Slideshow.

  • Slide: will navigate with the right arrow
  • Sub-Slide: will navigate with the down arrow
  • Fragment: will get added to the current Slide or Sub-Slide on the next arrow
  • Notes, Skip: won’t be part of the Slideshow
  • -, : will appear at the bottom of the Slide or Sub-Slide as part of the last execution of the Slide or Sub-Slide

Additional Tips and Reflection

In order to add headers or footers to a slide, utilize the markdown options for Jupyter Notebook.

If there is too much content on a slide, some of the content will not appear at the bottom and will be cut out of the slide.

The Jupyter Notebook Slideshow can be very helpful for certain Presentations, as the Slideshows can be constructed without transporting Jupyter Notebook information to a presentation software. But other software exist for good reasons and may be better options for certain situations.


If you enjoyed this article and would like to read (and write) more articles like this, please consider clicking the Follow button by my profile picture and/or subscribing to a medium membership using my referral link: https://sabolch-horvat.medium.com/membership


Related Articles