Resources for IPython presentations

A list of useful IPython tools I’ve made/compiled from other people that I use in my IPython presentations.

Formatted tables

  • Formatted tables in IPython
  • ipy_table library

Widgets for animated slides
For these, I have forked the ipywidgets github repository and added my own useful widgets for animation.

Adding animated figures to IPython presentations
Adding animated tables to IPython presentations

Templates

For many presentations, you may not want the code from input cells to be visible. I use the template posted on @damian_vila’s blog. This allows you to hide the input slides, but clicking on the output cell toggles the input cell. This makes it really fun in presentations, if someone asks how you did something, simply click on the figure/table to reveal the code! To use a template to compile your slides:

  • Create a directory where you will store your templates
  • Add this directory to the list:
  • c.HTMLExporter.template_path
  • in ~.ipython/profile_default/ipython_nbconvert_config.py

Use the template when compiling your slides. If you named the tamplate my_template.tpl, and stored it in a directory listed in the list below, you can do:

ipython nbconvert my_slides.ipynb –to slides –template my_template

Other useful functions

Center a figure

import matplotlib.pyplot
import rpy2.robjects
import IPython.core.display
from IPython import get_ipython

def center_figure(fig):
ip = get_ipython()
png_rep = ip.display_formatter.formatters“image/png”
matplotlib.pyplot.close(fig)
return IPython.core.display.HTML(‘

Example

Here’s an example slideshow showing these features, and the ipynb file used to generate it (make sure the “Cell Toolbar” is set to “Slideshow”).