我正在尝试绘制以下形式的行的.txt文件:
filename.txt date magnitude
V098550.txt 362.0 3.34717962317
我试图将日期与幅度进行对比。
import numpy as np
import matplotlib.pyplot as plt
#names = '/home/sindelj/research/condensed.txt'
x, y, z= np.loadtxt ("condensed.txt", usecols=(1, 2), unpack=True)
for ii in range (len(names)):
x.replace('.txt', '.lc\n')
jd, npmag = ("np.loadtxt /net/jovan/export/jovan/oelkerrj/Vela/rotation/Vela/list.txt", +x[ii])
plt.scatter (jd, npmag)
plt.jdlabel ('Time')
plt.npmaglabel ('Mag')
plt.npmaglim ([15.,14.])
plt.show() # after test comment this out
fileName = names[ii][:-3] + ".png"
plt.savefig(fileName)
print "done"
答案 0 :(得分:1)
您没有打开文本文件,而只是分配"名称"成为一个字符串。