参考霍兰德人格分析雷达图的思路来设计一组学生八门课的成绩雷达图

import numpy as np
import matplotlib.pyplot as plt
import matplotlib

matplotlib.rcParams['font.family'] = 'SimHei'
# 雷达标签
feature = np.array(['C++', 'Python', '高数', '大学英语', '电路', '软件工程', '计算机网络', '数据结构'])
nAttr = 8

data = np.array([[80, 95, 78, 85, 50, 72, 82, 90],
                [75, 85, 74, 82, 75, 85, 75, 85],
                [85, 90, 71, 80, 80, 80, 89, 55],
                [82, 80, 70, 76, 86, 90, 91, 92],
                [70, 75, 80, 73, 72, 76, 82, 81],
                [65, 92, 82, 72, 67, 81, 70, 77]])
data_labels = ('文英', '赵普', '颜燕', '李科', '董晓', '杨阳')
angles = np.linspace(0, 2 * np.pi, nAttr, endpoint=False)
# 将360度评分成8份,因为八门学科

fig = plt.figure(facecolor="white")  # 绘制全局绘图区域
plt.subplot(111, polar=True)  # 绘制一个1行1列的极坐标系子图,当前位置为1

plt.figtext(0.52, 0.95, '某组学生课程成绩', ha='center', size=20)
# 放置标题,ha是horizon
plt.thetagrids(angles * 180 / np.pi, feature)  # 放置科目(feature)
for i in range(0, 6):  # 连6部分嘛
    plt.plot(angles, data[i], 'o-', linewidth=1.5, alpha=0.2)  # 连线
    plt.fill(angles, data[i], alpha=0.25)  # 填充,alpha是透明度

legend = plt.legend(data_labels, loc=(0.94, 0.80), labelspacing=0.1)
# 放置图注,右上角
plt.setp(legend.get_texts(), fontsize='large')
plt.grid(True)  # 打开坐标网络

plt.show()



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值