代码之家  ›  专栏  ›  技术社区  ›  Baron Yugovich

禁止Matplotlib中的输出

  •  2
  • Baron Yugovich  · 技术社区  · 6 年前

    这就是我的阴谋

    from matplotlib import pyplot
    pyplot.figure();
    pyplot.scatter(x=data[feat], y=data[target]);
    pyplot.xlabel(feat);
    pyplot.ylabel(target);
    pyplot.show();
    

    我得到的输出就像

    Figure size 432x288 with 0 Axes>
    
    <matplotlib.collections.PathCollection at 0x7fd80c2fbf50>
    
    Text(0.5,0,'Age1')
    
    Text(0,0.5,'Target')
    

    如何抑制此输出?分号不起作用。我正在一个Jupyter笔记本上运行这个程序。

    2 回复  |  直到 6 年前
        1
  •  2
  •   sacuL    6 年前

    _

    from matplotlib import pyplot
    
    _ = pyplot.figure()
    _ = pyplot.scatter(x=data[feat], y=data[target])
    _ = pyplot.xlabel('feat')
    _ = pyplot.ylabel('target')
    pyplot.show()
    

    MATLAB python

        2
  •  1
  •   hsnee    6 年前

    https://github.com/ipython/ipython/issues/10794

    from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all"

    all last_expr

    print

    ;

    pass;