我必须从我的 excel 文件中读取和绘制数据的代码是这样的:
import pandas as pd
import matplotlib.pyplot as plt
excel_file = 'file1.xlsx'
file1 = pd.read_excel(excel_file)
file1.head()
plt.plot(x,y1,y2)
plt.xlabel('wavelenghts')
plt.ylabel('reflectivity')
plt.legend(loc='upper left')
plt.show
有用。
问题是:
y3, y4,...
我收到 y3 is undefined.
的错误y1
的名称至CK4/5-PCA82500
和其他人一样。有什么办法吗? 最佳答案
f, ax = figure()
plt.plot(file1.x,file1.y1,label='')
plt.plot(file1.x,file1.y2)
plt.plot(file1.x,file1.y3)
.....
plt.xlabel('wavelenghts')
plt.ylabel('reflectivity')
plt.legend(loc='upper left')
plt.show
关于excel - 在 Python 中绘制 Excel 中的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56244037/