import matplotlib.pyplot as plt
from matplotlib import cm
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus'] = False
ans_sum = [
[],
[-1, 2, 3, 4],
[2, 3, 4, 5],
[3, 4, 5, 6],
[4, 5, 6, 7],
]
calc_pull = 3
y = range(calc_pull + 1)
ax = plt.subplot(111)
for i in range(1, len(ans_sum)):
x = ans_sum[i]
plt.plot(x, y, color=cm.Blues(0.8), lw=2.5, label=f'折线 {i}')
plt.xlabel('X轴标签')
plt.ylabel('Y轴标签')
plt.title('折线图示例')
ax.minorticks_on()
plt.grid(True, which='major', alpha=0.6)
plt.grid(True, which='minor', alpha=0.3)
plt.legend()
plt.show()