Python
导入必要的库
import matplotlib.pyplot as plt
定义一个函数,用于展示编程学习的曲线图
def plot_learning_curve(level, days, progress):
"""
绘制编程学习曲线图。
:param level: 学习阶段,例如 '初级', '中级', '高级'
:param days: 学习天数列表
:param progress: 学习进度列表
"""
plt.figure(figsize=(10, 5))
plt.plot(days, progress, marker='o')
plt.title(f'编程学习曲线 - {level}阶段')
plt.xlabel('学习天数')
plt.ylabel('学习进度')
plt.grid(True)
plt.show()
示例数据
days = list(range(1, 31)) progress初级 = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] progress中级 = [15, 30, 45, 60, 75, 90, 105, 120, 135, 150] progress高级 = [20, 40, 60, 80, 100, 120, 140, 160, 180, 200]
绘制不同学习阶段的曲线图
plot_learning_curve(‘初级’, days, progress初级) plot_learning_curve(‘中级’, days, progress中级) plot_learning_curve(‘高级’, days, progress高级)
