# 创建决策树可视化
fig, ax = plt.subplots(figsize=(12, 8)) # 创建子图布局
# 绘制决策树
ax.text(0.5, 0.95, '如何选择多重检验校正方法?', # 添加文本标签
# 定义fontsize变量
fontsize=16, fontproperties='Source Han Serif SC', ha='center', weight='bold')
# 第一层:目标
ax.annotate('你的首要目标是什么?', xy=(0.5, 0.85), # 添加注释标注
xytext=(0.5, 0.85), fontsize=12, fontproperties='Source Han Serif SC', # 设置标注文字的偏移位置
ha='center', va='center', # 定义ha变量
bbox=dict(boxstyle='round,pad=0.5', fc='lightblue', alpha=0.5)) # 定义bbox变量
# 第二层:严格性
# 添加文本标签
ax.text(0.25, 0.70, '控制至少一次误拒的概率\n(FWER)', fontsize=11, fontproperties='Source Han Serif SC',
ha='center', va='center', # 定义ha变量
bbox=dict(boxstyle='round,pad=0.5', fc='lightyellow', alpha=0.5)) # 定义bbox变量
# 添加文本标签
ax.text(0.75, 0.70, '允许一些错误\n(最大化发现)', fontsize=11, fontproperties='Source Han Serif SC',
ha='center', va='center', # 定义ha变量
bbox=dict(boxstyle='round,pad=0.5', fc='lightgreen', alpha=0.5)) # 定义bbox变量
# 第三层:具体方法
# 添加文本标签
ax.text(0.25, 0.50, '使用 FWER 控制方法:', fontsize=11, fontproperties='Source Han Serif SC',
ha='center', weight='bold') # 定义ha变量
ax.text(0.25, 0.42, '• 任意依赖:Bonferroni / Holm\n• 独立或特定正依赖:Hochberg', # 添加文本标签
fontsize=10, fontproperties='Source Han Serif SC', ha='center', # 定义fontsize变量
bbox=dict(boxstyle='round,pad=0.5', fc='white', alpha=0.8)) # 定义bbox变量
# 添加文本标签
ax.text(0.75, 0.50, '使用 FDR 控制方法:', fontsize=11, fontproperties='Source Han Serif SC',
ha='center', weight='bold') # 定义ha变量
# 添加文本标签
ax.text(0.75, 0.42, '• 独立/PRDS:BH\n• 任意依赖:BY\n• Storey:需额外条件',
fontsize=10, fontproperties='Source Han Serif SC', ha='center', # 定义fontsize变量
bbox=dict(boxstyle='round,pad=0.5', fc='white', alpha=0.8)) # 定义bbox变量
# 第四层:应用场景
ax.text(0.25, 0.25, '典型应用:', fontsize=11, fontproperties='Source Han Serif SC', # 添加文本标签
ha='center', weight='bold') # 定义ha变量
ax.text(0.25, 0.15, '• 高频交易策略验证\n• 重大投资决策\n• 高风险决策', # 添加文本标签
fontsize=10, fontproperties='Source Han Serif SC', ha='center', # 定义fontsize变量
bbox=dict(boxstyle='round,pad=0.5', fc='white', alpha=0.8)) # 定义bbox变量
ax.text(0.75, 0.25, '典型应用:', fontsize=11, fontproperties='Source Han Serif SC', # 添加文本标签
ha='center', weight='bold') # 定义ha变量
ax.text(0.75, 0.15, '• 多因子选股\n• 量化策略回测\n• 大规模筛选', # 添加文本标签
fontsize=10, fontproperties='Source Han Serif SC', ha='center', # 定义fontsize变量
bbox=dict(boxstyle='round,pad=0.5', fc='white', alpha=0.8)) # 定义bbox变量
# 连接线
ax.annotate('', xy=(0.35, 0.70), xytext=(0.45, 0.82), # 添加注释标注
arrowprops=dict(arrowstyle='->', lw=2)) # 定义arrowprops变量
ax.annotate('', xy=(0.65, 0.70), xytext=(0.55, 0.82), # 添加注释标注
arrowprops=dict(arrowstyle='->', lw=2)) # 定义arrowprops变量
ax.set_xlim(0, 1) # 设置子图X轴范围
ax.set_ylim(0, 1) # 设置子图Y轴范围
ax.axis('off') # 执行数据处理操作
plt.tight_layout() # 自动调整子图间距
plt.show() # 显示图形