matplotlibで描画できるグラフがわからないので自分用のギャラリーを作っている

github.com

matplotlibには色々なメソッドがいっぱい

なんか色々あるけれど。どういうものがあるのか把握していない。分かっているのは以下2つだけの様な状況

  • plot
  • hist

たぶんそれ以外にも色々あるかんじ。

matplotlibの例は多すぎるし複雑過ぎる

matplotlibのexampleやgalleryは以下のところにある。

一個一個見ていくには多すぎるし。見栄え重視でコードが複雑過ぎる例もあったりする。つらい。

自分用のギャラリーを作ってみる

自分用のギャラリーというかsandbox+利用例の様なものを作ってみることにした。

やり方は単純で

  1. https://matplotlib.org/api/axes_api.html#plotting のPlotting部分の要素を選ぶ
  2. <number>plot_<name>.py のようなファイルを作る
  3. ここに簡単な利用例のコードを書く

そして、Makefile経由で出力結果の画像とそれらをまとめたギャラリー的なmarkdown(readme.md)を生成している。

https://github.com/podhmo/utatane/tree/master/examples/02plot

現在は以下が終わっている

  • plot
  • errorbar
  • scatter

あと、どうせなのでnumpyの方をあえてつかっている。

plot errorbar scatter

nbreversibleがreversibleになった

github.com

nbreversibleがreversibleになった。

reversible?

readmeより

# convert .ipynb to .py
$ python -m nbreversible foo.ipynb > foo.py

# convert .py to .ipynb
$ python -m nbreversible foo.py > foo.ipynb

# re: convert .ipynb to .py
$ python -m nbreversible foo.ipynb > foo.py

そういうこと。

example

この辺見て。

https://github.com/podhmo/nbreversible/tree/master/examples/03ipynb2python