我正在通過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