Python-雷达分析图
作者:互联网
import numpy as np import matplotlib.pyplot as plt import matplotlib matplotlib.rcParams['font.family']='SimHei' matplotlib.rcParams['font.sans-serif']=['SimHei'] radar_labels = np.array(['一','二','三','四','五','六','七','八','九','十']) nAttr = 10 #雷达图分几等分 data = np.array([0.450,0.900,0.850,0.700,0.400,0.650,0.950,0.908,1.000,1.000],) #数据值 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 ='gray',linewidth=1,alpha=0.2) plt.plot(angles,data,'o-', color='g',linewidth=1.5, alpha=0.2) plt.fill(angles,data,facecolor='g', alpha=0.25) #填充色为绿色 plt.thetagrids(angles*180/np.pi, radar_labels) plt.figtext(0.52, 0.95, 'Anjora的成绩表', ha='center', size=20) #头标题 plt.grid(True) plt.savefig('Anjora的成绩表.JPG') #另存文件名 plt.show()
标签:分析,plt,Python,matplotlib,angles,import,np,雷达,data 来源: https://www.cnblogs.com/Anjoras-bk/p/12961454.html