jupyter notebookにてplotを使うとグラフが表示されない。
プログラムの先頭に以下を書けば表示される。
%matplotlib inline
他にも起動時に以下を記載してもOK。
jupyter notebook --matplotlib inline
更に他にもnotebookのプロファイルを設定でもよい。
もし設定をしていないようでしたら、以下のcommandで作成する。
ipython profile create
これでできた~/.ipython/profile_default/ipython_config.pyを編集する。
# lines of code to run at IPython startup.
# c.InteractiveShellApp.exec_lines = traitlets.Undefined
c.InteractiveShellApp.exec_lines = ['%matplotlib inline']
c.InteractiveShellApp.exec_lines = ['%matplotlib inline']の行を追加する。
あとはいつも通りnotebookを起動させれば自動的に%matplotlib inlineが有効になる。
