我正在通过ipython笔记本教程,它说要在单元中运行这个教程。 进口numpy的为NP 进口数学 进口matplotlib.pyplot如PLT在ipython笔记本上显示matplotlib时出错
x = np.linspace(0, 2*math.pi)
plt.plot(x, np.sin(x), label=r'$\sin(x)$')
plt.plot(x, np.cos(x), 'ro', label=r'$\cos(x)$')
plt.title(r'Two plots in a graph')
plt.legend()
,我应该得到一个实际的图形。 Isntead我得到
<matplotlib.legend.Legend at 0x1124a2fd0>
我应该怎么做呢?
'plt.show()应在该脚本的末尾加上'。 – Abdou