#範例2-8:結合numpy與matplotlib的繪圖,畫出三條線(y=x,y=x^2, y=x^3) import matplotlib.pyplot as plt import numpy as np # 從0~5,每隔0.01取一個點當作x x = np.arange(0,5,0.01) # y = x plt.plot(x,x,'r-') # y = x^2 plt.plot(x,x*x,'b:') # y = x^3 plt.plot(x,x*x*x,'g--') plt.show()