zoukankan      html  css  js  c++  java
  • Python成绩雷达图

    代码
    1 import numpy as np 2 import matplotlib 3 import matplotlib.pyplot as plt 4 matplotlib.rcParams['font.family']='SimHei' 5 matplotlib.rcParams['font.sans-serif']='SimHei' 6 labels=np.array(['第一周','第二周','第三周','第四周','第五周','第六周','第七周']) 7 nAttr=7 8 data=np.array([0,8.7,10,8,9.7,8.1,0]) 9 angles=np.linspace(0,2*np.pi,nAttr,endpoint=False) 10 data=np.concatenate((data,[data[0]])) 11 angles=np.concatenate((angles,[angles[0]])) 12 fig=matplotlib.pyplot.figure(facecolor="white") 13 matplotlib.pyplot.figure(facecolor="white") 14 matplotlib.pyplot.subplot(111,polar=True) 15 matplotlib.pyplot.plot(angles,data,'bo-',color='g',linewidth=2) 16 matplotlib.pyplot.fill(angles,data,facecolor='g',alpha=0.25) 17 matplotlib.pyplot.thetagrids(angles*180/np.pi,labels) 18 matplotlib.pyplot.figtext(0.52,0.95,'SG.zhang成绩雷达图',ha='center') 19 matplotlib.pyplot.grid(True) 20 matplotlib.pyplot.savefig('dota_radar.JPG') 21 matplotlib.pyplot.show()

    运行结果

  • 相关阅读:
    Tempter of the Bone
    CODE[VS]1160 蛇形矩阵
    CODE[VS] 1205 单词翻转
    CODE[VS] 1204 寻找子串位置
    a little sweet~
    我多喜欢你,你会知道
    P1474 货币系统 Money Systems
    P1096 Hanoi双塔问题
    P1209 [USACO1.3]修理牛棚 Barn Repair
    下一秒
  • 原文地址:https://www.cnblogs.com/SGzhang/p/10743512.html
Copyright © 2011-2022 走看看