import matplotlib.pyplot as plt
import numpy as np
# --- 模拟米尔格拉姆实验数据 ---
# 创建电压等级
voltages = np.arange(0, 451, 15)
# 模拟不同电压等级下的服从百分比(基于经典研究结果)
obedience_levels = np.array([
100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
92.5, 90, 85, 82.5, 80, 80, 77.5, 75, 70, 67.5,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65
])
# 使用插值法平滑曲线
full_obedience = np.interp(voltages, np.arange(0, len(obedience_levels)) * 15, obedience_levels)
# --- 绘图 ---
plt.style.use('seaborn-v0_8-whitegrid')
fig, ax = plt.subplots(figsize=(10, 6))
ax.plot(voltages, full_obedience, marker='', linestyle='-', color='crimson', lw=3)
ax.fill_between(voltages, full_obedience, color='crimson', alpha=0.1)
# --- 美化图表元素 ---
ax.set_title('权威服从的“渐进陷阱”:从合规到不当销售', fontsize=18, pad=20)
ax.set_xlabel('指令的风险/道德偏离程度 (模拟电压)', fontsize=14)
ax.set_ylabel('服从指令的理财经理百分比 (%)', fontsize=14)
ax.set_xticks(np.arange(0, 451, 75))
ax.set_yticks(np.arange(0, 101, 20))
# --- 添加关键点注释 ---
critical_point_v = 150
critical_point_p_index = np.where(voltages == critical_point_v)[0][0]
critical_point_p = full_obedience[critical_point_p_index]
ax.axvline(x=critical_point_v, color='gray', linestyle='--')
ax.plot(critical_point_v, critical_point_p, 'ko', markersize=8)
ax.annotate('关键转折:\n首次出现\n显著风险错配',
xy=(critical_point_v, critical_point_p),
xytext=(critical_point_v + 15, 90),
arrowprops=dict(facecolor='black', shrink=0.05, width=1, headwidth=8),
ha='left', fontsize=12, color='black',
bbox=dict(boxstyle="round,pad=0.3", fc="white", ec="none", alpha=0.7))
ax.set_ylim(0, 105)
ax.set_xlim(-10, 460)
plt.tight_layout()
plt.show()