liyanyinng

一、参考的代码如下:

 1 import numpy as np
 2 import matplotlib.pyplot as plt
 3 import matplotlib
 4 matplotlib.rcParams[\'font.family\']=\'SimHei\'
 5 matplotlib.rcParams[\'font.sans-serif\']=[\'SimHei\']
 6 labels=np.array([\'不合格\',\'合格\',\'良好\',\'优秀\'])
 7 nAttr=4
 8 data=np.array([0,0.879,3,0.875])
 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=plt.figure(facecolor="white")
13 plt.subplot(111,polar=True)
14 plt. plot(angles,data,\'bo-\',color=\'g\',linewidth=2)
15 plt.fill(angles,data,facecolor=\'b\',alpha=0.25)
16 plt.thetagrids(angles*180/np.pi,labels)
17 plt.figtext(0.52,0.95,\'python123作业成绩雷达图\',ha=\'center\')
18 plt.figtext(0.10,0.94,\'num:10\')
19 plt.figtext(0.10,0.90,\'author:Yong\')
20 plt.grid(True)
21 plt.savefig(\'dota_radar.JPG\')
22 plt.show()

二、查看效果:

可以看到,图表可以非常直观的分析成绩,另外还可以在旁白加上自己的学号和标签。

其他的例子也是一样,只要把代码中的数值改一下就行了

 

分类:

技术点:

相关文章:

  • 2022-01-21
  • 2022-01-01
  • 2022-12-23
  • 2021-07-17
  • 2021-12-19
  • 2021-12-27
  • 2021-04-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-26
  • 2021-11-14
  • 2021-12-25
相关资源
相似解决方案