2016-06-27 4 views
4

나는 jupyter notebook이 어떻게 줄거리를 인라인 할 수 있는지 궁금하다. 나는 github에서 %matplotlib inline을 (를) 검색했으며 소스 코드 (https://github.com/search?l=python&q=org%3Ajupyter+matplotlib+inline&ref=searchresults&type=Code&utf8=%E2%9C%93)를 찾지 못했습니다.Jupyter & IPython : % matplotlib 인라인은 무엇을합니까?

그리고 문서 (http://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-matplotlib)에는 사용할 수 없습니다.

누구나 %matplotlib inline의 소스 코드를 어디에서 볼 수 있습니까?

답변

4

당신은 python3.5/site-packages/IPython/core/magics/pylab.py

args = magic_arguments.parse_argstring(self.matplotlib, line) 
    if args.list: 
     backends_list = list(backends.keys()) 
     print("Available matplotlib backends: %s" % backends_list) 
    else: 
     gui, backend = self.shell.enable_matplotlib(args.gui) 
     self._show_matplotlib_backend(args.gui, backend) 

우리가 코드 발견이에서

%matplotlib?? # view source 

를 통해 일을하고있는 라인을 jupyter 노트북에서하기 matplotlib 마법의 소스를 찾을 수 있습니다 자체입니다. shell.enable_matplotlib. 당신은 IPython GitHub의 저장소에이를 찾을 수 있습니다 https://github.com/ipython/ipython/blob/aa586fd81940e557a1df54ecd0478f9d67dfb6b4/IPython/core/interactiveshell.py#L2918-L2961

: https://github.com/ipython/ipython/blob/aa586fd81940e557a1df54ecd0478f9d67dfb6b4/IPython/core/magics/pylab.py#L100

이 interactiveshell.py의 코드를 호출

관련 문제