5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

jupyterで%matplotlib inlineしなくてもinlineになっているわけ

Posted at

背景、疑問

ただいまjupyterで機械学習についてオンラインコースで勉強しているところなのですが、そこで%matplotlib inlineしないとcell内にグラフが表示されないよ、と教えられました。

がしかし、%matplotlib inlineコマンド実行しなくてもcell内にグラフが表示されるので、なぜかと思ってちょっと調べてみました。

原因まとめ

もともとは%matplotlib inlineする必要があったようです。
しかし、あるときからデフォルトでinlineがオンになるように修正されたようです。
コミットログとGitHubのリリースタブからipykernel 4.4.0からはinlineがデフォルトでオンになっているようです。

コミットログ

コミットログを見ると2016/07/13にコミットされた変更のようです。

$ git clone https://github.com/docker/doodle.git
$ cd ipykernel/
$ git log -1 70e096805778cb79eb1729f5bb2f9ddebf85e001
commit 70e096805778cb79eb1729f5bb2f9ddebf85e001
Author: Benjamin Ragan-Kelley <benjaminrk@gmail.com>
Date:   Wed Jul 13 19:54:24 2016 -0500

    Make inline the default matplotlib backend

    uses MPLBACKEND env (matplotlib > 1.5).

    Trigger extra IPython inline setup when inline backend is loaded.
    We can't call the simpler `ip.enable_matplotlib()` here because
    this will be triggered during pyplot import,
    and enable_matplotlib() imports pyplot which isn't ready yet.

GitHubのReleasesタブ

そしてその変更がどのバージョンで取り込まれたのかをGitHubのreleasesタブで見てみると4.4.0から含まれているようです。
https://github.com/ipython/ipykernel/releases?after=4.4.1

その他

GitHubにissueもあがっていました。(反映されていないようで、まだOpenのままですが・・・)
https://github.com/ipython/ipython/issues/6424

5
0
0

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
5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?