numpy与matplotlib的学习随笔
我爱代码
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([100,90,90,100,90,87])
angles=np.linspace(0,2*np.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,'23号黄廉智成绩雷达图',ha='center')
plt.grid(True)
plt.savefig('dota_radar.JPG')
plt.show
效果图