How to make IPython notebook matplotlib plot inline

后端 未结 10 2320
轮回少年
轮回少年 2020-11-22 14:37

I am trying to use IPython notebook on MacOS X with Python 2.7.2 and IPython 1.1.0.

I cannot get matplotlib graphics to show up inline.

import matplo         


        
10条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 15:04

    I used %matplotlib inline in the first cell of the notebook and it works. I think you should try:

    %matplotlib inline
    
    import matplotlib
    import numpy as np
    import matplotlib.pyplot as plt
    

    You can also always start all your IPython kernels in inline mode by default by setting the following config options in your config files:

    c.IPKernelApp.matplotlib=
      Default: None
      Choices: ['auto', 'gtk', 'gtk3', 'inline', 'nbagg', 'notebook', 'osx', 'qt', 'qt4', 'qt5', 'tk', 'wx']
      Configure matplotlib for interactive use with the default matplotlib backend.
    

提交回复
热议问题