Do a Gnuplot of a file in python

S

Santix

I am doing a python program that save the data in a text file in columns and
I want to do a gnuplot to plot the results.
But I want the program in python to show the result with gnuplot.
I have tried this:

g.load(power.p)

but it gives me this error:

Traceback (most recent call last):
File "./spectrum_output.py", line 310, in <module>
main_loop(tb)
File "./spectrum_output.py", line 289, in main_loop
g.load(power.p)
AttributeError: 'file' object has no attribute 'p'

On power.p I have this:

set autoscale
unset logscale
unset label
set xtic auto
set ytic auto
set title "Spectrum Analyzer"
set xlabel "Frecuency"
set ylabel "Power (dB)"
plot "power.dat" using 1:2 title 'm.data[0]' with linespoints

And in power.dat:
2231500000.0 18.2582263947
2234500000.0 17.0396003723
... ...
with more data

It goes ok when I load it in gnuplot, but not when I execute the python
program in the Terminal.

Thanks in advance!

Regards,

Santiago Ortega.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top