File size: 1,913 Bytes
f2364fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import matplotlib.pyplot as plt
import numpy as np

# # 中文显示(需要安装思源宋体或其他中文字体)
# plt.rcParams['font.sans-serif'] = ['SimHei']  # 可换为 'Source Han Sans CN' 等
# plt.rcParams['axes.unicode_minus'] = False

# 标签(12项)
labels = [
    '\nOlympiad',
    '\nGPQA-Diamond',
    '\nGAOKAO-MM',
    '\nMathVista',
    '\nMMMU',
    '\nM³oralBench',
    '\nMM-SafetyBench',
    '\nSIUO',
    '\nFLAMES',
    '\nMSSBench',
]

# 补齐到12项(图片中是12边形,可能有2项未标出,补齐平滑对称)
labels = labels[:5] + [''] + labels[5:] + ['']
num_vars = len(labels)

# 数据
base_model_scores = [59.88, 59.60, 78.17, 76.10, 70.94, 64.50, 92.04, 90.53, 65.31, 74.83, 0, 0]
safe_model_scores = [59.88, 59.60, 78.17, 76.10, 70.94, 64.50, 92.04, 90.53, 65.31, 74.83, 0, 0]

# 转为角度
angles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()
scores_base = base_model_scores + [base_model_scores[0]]  # 闭合
scores_safe = safe_model_scores + [safe_model_scores[0]]
angles += [angles[0]]

# 图形设置
fig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(polar=True))

# 绘制
ax.plot(angles, scores_base, color='#4B63FF', linewidth=2, label='s')
ax.fill(angles, scores_base, color='#4B63FF', alpha=0.2)

ax.plot(angles, scores_safe, color='#FF77AC', linewidth=2, label='SafeWork-R1', marker='s')
ax.fill(angles, scores_safe, color='#FF77AC', alpha=0.2)

# 设置刻度与标签
ax.set_xticks(angles[:-1])
ax.set_xticklabels(labels, fontsize=10)

# 设置范围与网格
ax.set_rlabel_position(0)
ax.set_ylim(50, 100)
ax.yaxis.grid(True)
ax.xaxis.grid(True)

# 添加图例
plt.legend(loc='lower center', bbox_to_anchor=(0.5, -0.1), ncol=2)

plt.title('a vs b', fontsize=14, pad=20)
plt.tight_layout()

# 保存图片
plt.savefig('radar_chart.png', dpi=300, bbox_inches='tight')  # 或保存为 PDF: 'radar_chart.pdf'

plt.show()