This first slide is only text
Slides can contain:
x = linspace(0,10,100)
y = x**2
plot(x,y,'k')
[<matplotlib.lines.Line2D at 0x7f21fe3f8310>]
Click on the graph to see the code that generated it. (This feature requires a special template file. By default, the input cell is always shown.)
You can have "slide fragments" which activate when you press the arrow key, such as this image I grabbed from the web:
from IPython.display import Image
Image(url='http://icon.ssl.berkeley.edu/portals/devicon/Images/science/ICON-AT-WORK.png')
Another neat feature is sub-slides. Try hitting "down"
Sub-slide 1
Sub-slide 2: Even youtube videos work!
from IPython.display import YouTubeVideo
YouTubeVideo('b7RxrFT3cnw', start=15)
This slideshow was created from this IPython notebook.
To make your notebook into a slideshow, first, in the notebook, Choose "Cell Toolbar"-->"Slideshow". Then, modify each cell's "Slide Type" as appropriate (see here for more information, though it's slightly outdated). Don't forget to save the notebook. Then run the following code at the end of the notebook, which:
import subprocess
import shutil
nb_name = 'Slideshow_example.ipynb' # There's probably a way to get this programmatically
cmd = ['ipython', 'nbconvert', '--to', 'slides', nb_name, \
'--reveal-prefix', '"http://cdn.jsdelivr.net/reveal.js/2.6.2"',\
'--template','output_toggle']
# The --template command points to a custom template which opens and closes the input code cells with a click
subprocess.call(cmd)
html_name = '%s.slides.html' % (nb_name.split('.')[0])
shutil.copy(html_name, '/home/bhardin2/public_html/slideshows/')
print '(click to reveal code)'
(click to reveal code)
(The "--template output_toggle" option allows you to hide code cells, and reveal them by clicking. If you want to use this, put the output_toggle.tpl file in the same directory as your notebooks.)
After running the above code, view the slideshow by navigating a browser to the file.
xkcd()
figure(figsize=(5,3))
t = linspace(0,10,100)
y = (10-t)*sin(t)
plot(t,y,'g')
[<matplotlib.lines.Line2D at 0x7f21fde06d10>]