Suppress output of object when plotting in ipython

感情迁移 提交于 2020-04-07 15:05:15

问题


Is it possible to suppress the array output when plotting a histogram in ipython?:

For example:

plt.hist(OIR['Range'], bins, named=True, histtype='bar')

outputs/prints the array information before displaying the graph.


回答1:


Assign the return value to a variable (which I call _ to indicate it's unused):

_ = plt.hist(...)



回答2:


just put ; after the code.
It works only in ipython-notebook.

plt.hist(...);




回答3:


You can also add plt.show():

plt.hist(OIR['Range'], bins, named=True, histtype='bar')
plt.show() 


来源:https://stackoverflow.com/questions/14506583/suppress-output-of-object-when-plotting-in-ipython

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!