python123作业成绩雷达图

import numpy as np
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rcParams['font.family']='SimHei'
matplotlib.rcParams['font.sans-serif']='SimHei'
labels=np.array(['第一周','第二周','第三周','第四周','第五周','第六周'])
nAttr=6
data=np.array([100,90,90,90,90,90])
angles=np.linspace(0,2*np.pi,nAttr,endpoint=False)
data=np.concatenate((data,[data[0]]))
angles=np.concatenate((angles,[angles[0]]))
fig=matplotlib.pyplot.figure(facecolor="white")
matplotlib.pyplot.figure(facecolor="white")
matplotlib.pyplot.subplot(111,polar=True)
matplotlib.pyplot.plot(angles,data,'bo-',color='g',linewidth=2)
matplotlib.pyplot.fill(angles,data,facecolor='g',alpha=0.25)
matplotlib.pyplot.thetagrids(angles*180/np.pi,labels)
matplotlib.pyplot.figtext(0.52,0.95,'成绩雷达图',ha='center')
matplotlib.pyplot.grid(True)
matplotlib.pyplot.savefig('成绩雷达图.JPG')
matplotlib.pyplot.show()

python123作业成绩雷达图_第1张图片

你可能感兴趣的:(python123作业成绩雷达图)