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()

    运行结果

  • 相关阅读:
    魔术方法之__call与__callStatic方法
    thinkphp5 实现搜索分页能下一页保留搜索条件
    koa2
    mongodb
    nodejs
    小程序
    Vue学习
    js4
    扎心!来自互联网er的2019年度总结,看完笑着流泪……
    谈谈“奋斗逼!”
  • 原文地址:https://www.cnblogs.com/SGzhang/p/10743512.html
Copyright © 2011-2022 走看看