Do a Gnuplot of a file in python

2008-10-23 Thread 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 
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:
223150.018.2582263947
223450.017.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. 
-- 
View this message in context: 
http://www.nabble.com/Do-a-Gnuplot-of-a-file-in-python-tp20134007p20134007.html
Sent from the Python - python-list mailing list archive at Nabble.com.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Do a Gnuplot of a file in python

2008-10-27 Thread Santix

Thanks a lot because it works with
 g.load("power.p")

But now I have this problem 

gnuplot> load 'power.p'
gnuplot> set terminal postscript enhanced color
gnuplot> set output "spectrum.ps"
gnuplot> plot 
gnuplot> set terminal x11
gnuplot> set output

gnuplot> plot 
  ^
 line 0: function to plot expected

It plots one time and then I want the program to close the plot window and
do another iteration, then show a plot again, close it, another iteration,
etc...
What should I put in the "power.p" code? I've tried to put exit or close but
it doesn't close the plot window.

Thanks and Regards,

Santi.



Gabriel Genellina-7 wrote:
> 
> En Thu, 23 Oct 2008 13:58:20 -0200, Santix <[EMAIL PROTECTED]>  
> escribió:
> 
>> 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 
>> main_loop(tb)
>>   File "./spectrum_output.py", line 289, in main_loop
>> g.load(power.p)
>> AttributeError: 'file' object has no attribute 'p'
> 
> I don't know gnuplot nor what g.load expects - but probably some lines  
> above that you have something like this:
> power = open(...)
> Try with g.load("power.p") instead.
> 
> -- 
> Gabriel Genellina
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Do-a-Gnuplot-of-a-file-in-python-tp20134007p20191843.html
Sent from the Python - python-list mailing list archive at Nabble.com.

--
http://mail.python.org/mailman/listinfo/python-list