1.进入工作目录,打开cmd,输入jupyter notebook
2.画图的时候增加%matplotlib inline,使得图显示在notebook中
如:
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
X=np.linspace(-np.pi,np.pi,256,endpoint=True)#-π to+π的256个值
C,S=np.cos(X),np.sin(X)
plt.plot(X,C)
plt.plot(X,S)
plt.show()
网友评论