|
From: Jan B. <Jan...@ph...> - 2009-07-10 17:01:48
|
Instead of writing
g('now =', now)
you should pass a formatted string to gnuplot like
g( ('now = %s' % str(now) ) )
Or simply avoid the comma, "+" is a better choice ;-)
g( 'now =' + str(now) )
I am doing something quite similar with
function_string = "A*exp(-B*x)"
g( 'fit ' + function_string + ' \"filename\" u 1:2 via A,B' )
Jan
Am Freitag, 10. Juli 2009 18:19 schrieb Olan Byrne:
> Hello all,
>
> Just a quick question on something I seem to be stuck with. With gnuplot.py
> I want to be able to subtract the current timestamp from column 1. The most
> straight-forward way seems to be to set an interim value 'now' and then
> pass this into the plot statement. However I cannot figure out how to get
> the timestamp variable 'now' from python assigned in gnuplot. A segment of
> what I'm trying to do is below:
>
> py:
> from time import time
> now = time()
> print now
> g('now =', now) ## problem line. g() can't take the extra now
> input g.plot("'test.txt' using ($1-now):2")
>
> text.txt:
>
> 1247220778.304284 10
> 1247220778.406589 12
> 1247220778.509067 10
> 1247220778.713930 8
> 1247220778.816432 11
> 1247220778.918740 10
> 1247220779.021023 10
>
>
> Apologies if this is a simple question [which is seems like it is], but
> after spending ages googling I still can't find the solution! Thanks for
> any help..
>
> Olan
|