Plotting 2D in Python

核能气质少年 提交于 2019-12-23 04:47:39

问题


I am trying to line plot a function, but I am getting an error. How can I do this?

I am using Enthought Canopy.

In[35] : plt.plot(np.arange(0, nx, 1), Iftarray[:, ny/2])
Out[35]: [<matplotlib.lines.Line2D at 0x8332dd8>]

回答1:


Like Sam says in the comment: There is no error here; try:

plt.show()

You'll be surprised :)




回答2:


As the others said, the output text that you see is expected, not an error. However this information, while useful, does not address the question of why you are not seeing the plot.

If your IPython (Canopy's Python shell) is running in Pylab mode (as it does by default; see the Preferences dialog's Python tab to verify), then a plot window should also have been created. However often, depending on the OS, this plot window will not pop up on top of Canopy. So your first task is to poke around your windows and make sure that it's not really there, but you have not seen it.

If the IPython shell is not running in Pylab mode, then cenna75's response is correct; the plot won't display until you explicitly tell it to.



来源:https://stackoverflow.com/questions/17656964/plotting-2d-in-python

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