科学计算库学习报告
numpy与matplotlib的读书笔记:
很多函数的调用,很烦,其他一切ok
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams[‘font.family’]=‘SimHei’
matplotlib.rcParams[‘font.sans-serif’]=[‘SimHei’]
labels=np.array([‘第一次’,‘第二次’,‘第三次’,‘第四次’,‘第五次’,‘第六次’])
nAttr=6
data=np.array([90,93,93,100,96,97])
angles=np.linspace(0,2np.pi,nAttr,endpoint=False)
data=np.concatenate((data,[data[0]]))
angles=np.concatenate((angles,[angles[0]]))
fig=plt.figure(facecolor=“white”)
plt.subplot(111,polar=True)
plt.plot(angles,data,‘bo-’,color=‘g’,linewidth=2)
plt.fill(angles,data,facecolor=‘g’,alpha=0.25)
plt.thetagrids(angles180/np.pi,labels)
plt.figtext(0.52,0.92,‘20号刘骏杰成绩雷达图’,ha=‘center’)
plt.grid(True)
plt.savefig(‘dota_radar.JPG’)
plt.show
效果图:
tan函数的编码证明:
import numpy as np
import matplotlib.pyplot as plt
x=np.linspace(0,3,100)
y=np.sin(2np.pix)/np.cos(2np.pix)
plt.plot(x,y,‘k’,color=‘b’,linewidth=3,linestyle="-")
plt.show()
效果: