Hello All you Lovely People on stackoverflow,
I am trying to plot data using gnuplot. I start by reading through a table and pulling out the data I want. I write this data to a .dat file. As of now, I'm just trying to plot it through a command line but will add the necessary code to plot it from the python script after it's working.
My code which creates the .dat file-
#!/usr/bin/python
file = open("test_m.rdb")
table = open('table.dat', 'w+')
trash = file.readline()
trash = file.readline()
data = file.readline()
i = data.split()
flux = i[2]
observed = i[4]
table.write(flux + " " + observed,)
while 1:
line = file.readline()
i = line.split()
try:
flux = i[2]
observed = i[4]
except IndexError:
break
table.write("\n" + flux + " " + observed)
table.close()
The command I'm attempting to use in cygwin and the error-
gnuplot plot table.dat
0.058 2
^
"table.dat", line 1: invalid command
Thank you in advance. I appreciate any suggestions you can offer.