我的数据看起来像:
sites mp1 mp2
ry99 0.66 0.54
ry98 0.71 0.54
ry97 0.58 0.45
ry96 0.65 0.55
我在excel文件中有以下列表,我想在第一列和第三列之间绘制第一列,使用matplotlib在同一图表中。
当我尝试以下代码时,收到错误:
plt.plot (arr[1:,0],arr[1:,n],label=names[n])
IndexError: too many indices for array
这是我的代码:
import numpy as np
import matplotlib.pyplot as plt
arr = np.genfromtxt('C:\\Users\\abdulaziz.bello\\Desktop\\geodesy\\es99.csv', delimiter=' ', dtype=None)
names = (arr[0])
for n in range (1,len(names)):
plt.plot (arr[1:,0],arr[1:,n],label=names[n])
plt.legend()
plt.show()
任何帮助都将非常感谢您解决我的问题。我从Python开始