1 回答
TA贡献1847条经验 获得超11个赞
首先,您的数据是字符串。您应该将它们转换为浮点数。
然后,最简单的方法是多次调用 plot 函数,每行一次:
x = [['12.63', '13.50', '14.15', '15.18', '16.04', '17.28', '18.56', '19.70',
'20.90', '22.21', '23.25', '24.13'],
['13.39', '14.10', '15.05', '16.20', '17.55', '18.43', '19.75', '21.29',
'22.78', '24.00', '24.85', '24.81'],
['13.02', '13.86', '14.82', '15.80', '16.90', '17.99', '19.24', '20.79',
'22.30', '23.43', '24.38', '24.68']]
y = [['-15.09', '-15.19', '-15.23', '-15.32', '-15.07', '-15.11', '-15.04',
'-15.08', '-14.97', '-14.98', '-14.89', '-15.12'],
['-15.91', '-15.89', '-15.90', '-15.96', '-15.55', '-15.58', '-15.51',
'-15.48', '-15.42', '-15.40', '-15.85', '-16.64'],
['-15.71', '-15.75', '-15.83', '-15.83', '-15.54', '-15.55', '-15.53',
'-15.47', '-15.41', '-15.33', '-15.43', '-15.97']]
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot([float(n) for n in x[0]], [float(n) for n in y[0]], color='tab:blue')
ax.plot([float(n) for n in x[1]], [float(n) for n in y[1]], color='tab:orange')
ax.plot([float(n) for n in x[2]], [float(n) for n in y[2]], color='tab:red')
plt.show()
添加回答
举报