LoginSignup
35
34

More than 5 years have passed since last update.

iPython でスライド作り

Posted at

前提

iPython とは

IPython 3.x will be the last monolithic release of IPython, containing the notebook server, qtconsole, etc. The language-agnostic parts of the project: the notebook format, message protocol, qtconsole, notebook web application, etc. will move to new projects under the name Jupyter.

Jupyter とは

reveal.js とは

環境

  • python 3.4.3
  • ipython 3.1.0
  • reveal.js 2.6.2 (最新版は 3.1.0)

スライド作成

ipython nbconvert

ipython nbconvert --to FORMAT notebook.ipynbFORMAT のとこを slides とするとスライドを作れる。

実際に作られたスライドで作り方を紹介してくれています。

ただ情報は古いので雰囲気だけ。

一番手っ取り早く手元で確認するには

ipython nbconvert --to slides notebook.ipynb --post serve

とすると、ブラウザまで開いてくれます。

ただ、変換された html ファイルに何も手を加えないのであればこれで充分ですが、

Gyazo

Input[] スライドにいれたくないなあとか思うと思います。

hide input cell

IPython Slideshows Will Change the Way You Work
https://gist.github.com/hannes-brt/6207507

ipython nbconvert --to slids input.ipynb --stdout | ipy_hide_input > input.slides.html

とすればできるようにしてくれています。

ただ自分の環境では ipy_hide_inputprint が使われているところは print() に変更して

ipython nbconvert --to slids notebook.ipynb --stdout | python ipy_hide_input > notebook.slides.html

notebook.ipynb と同じフォルダに reveal.js (reveal.js 3.1.0 ではうまくいかなかった)フォルダを置いて
(中で <script src="reveal.js/js/reveal.js"></script> してる)

python -m http.server

http://localhost:8000/notebook.slides.html にアクセスすれば

Gyazo

Input[] がなくなりました。

GADFLY?

matplotlib ではなく、svg でブラウザ上でインタラクティブなグラフ描画が可能なものもちゃんとスライドにできるように変換してくれるのか?
当然できてほしいけど。

35
34
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
35
34