fork download
  1. # your code goes here
Success #stdin #stdout 0.02s 7156KB
stdin
import matplotlib.pyplot as plt

# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False

# 创建数据
semesters = ['2019春季', '2019秋季', '2020春季', '2020秋季', '2021春季', '2021秋季']
homework_count = [150, 170, 190, 210, 230, 250]

# 创建图表
plt.figure(figsize=(10, 6))
plt.plot(semesters, homework_count, marker='o', linestyle='-', color='b', linewidth=2)

# 添加数据标签
for x, y in zip(semesters, homework_count):
    plt.text(x, y, f'{y}', ha='center', va='bottom')

# 添加网格线
plt.grid(True, linestyle='--', alpha=0.6)

# 添加标题和标签
plt.title('教师作业批改量变化趋势 (2019 - 2021)', fontsize=16)
plt.xlabel('学期', fontsize=12)
plt.ylabel('每周批改作业量 (份)', fontsize=12)

# 显示图表
plt.show()
stdout
Standard output is empty