import matplotlib.pyplot as plt

# ===== 数据 =====
name = "张三"
scores = [60, 75, 80, 70, 90]
times = ["T1", "T2", "T3", "T4", "T5"]

# ===== 创建窗口 =====
plt.figure(figsize=(8, 5))

# ===== 画折线图 =====
plt.plot(times, scores, marker='o', color='blue', linewidth=2, markersize=8)

# ===== 标注分数 =====
for i, score in enumerate(scores):
    plt.text(i, score + 1.5, str(score), ha='center', fontsize=12)

# ===== 设置坐标轴 =====
plt.xlabel("考试次数", fontsize=12)
plt.ylabel("成绩", fontsize=12)
plt.title(f"{name} 的成绩走势图", fontsize=14)
plt.ylim(0, 100)

# ===== 显示网格 =====
plt.grid(True, linestyle='--', alpha=0.5)

# ===== 弹出窗口 =====
plt.tight_layout()
plt.show()