How to make IPython notebook matplotlib plot inline

后端 未结 10 2300
轮回少年
轮回少年 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:02

    You can simulate this problem with a syntax mistake, however, %matplotlib inline won't resolve the issue.

    First an example of the right way to create a plot. Everything works as expected with the imports and magic that eNord9 supplied.

    df_randNumbers1 = pd.DataFrame(np.random.randint(0,100,size=(100, 6)), columns=list('ABCDEF'))
    
    df_randNumbers1.ix[:,["A","B"]].plot.kde()
    

    However, by leaving the () off the end of the plot type you receive a somewhat ambiguous non-error.

    Erronious code:

    df_randNumbers1.ix[:,["A","B"]].plot.kde
    

    Example error:

    >
    

    Other than this one line message, there is no stack trace or other obvious reason to think you made a syntax error. The plot doesn't print.

提交回复
热议问题