I have a question, which if the answer is "you can't do that", might
be a suggestion:
Let say I have a data file with some time data:
2004 11 1 100.0
2005 1 15 90.2
2005 3 28 60.4
2006 4 15 23.8, etc
set xdata time
set timefmt "%Y %m %d"
p "data" us 1:4
Now I define a function:
f(t) = a * exp( -(t - t0) / tc)
I can fit with this function, and over plot the fit with:
p "data" us 1:4, f(x)
In the above, the function is called with the time in seconds.
But now I wish I could plot the residuals.
The thing I tried first:
p "data" us 1:4, "" us 1:($4 - f($1))
This produces a plot, but f() is called with just the year - not
the time is seconds.
I wish there was some way to get the x time value. Is there
already a way? - I was unable to puzzle one out...
Two possible syntaxes that I've thought of:
allow "$x" in a using expression to evaluate to the time
(and $y if "set ydata time" is in effect")
p "data" us 1:4,"" us 1:($4 - f($x))
of define a function, xtim (and ytim), which could be called with the
data file line number if it needs to have an argument
p "data" using 1:4,"" us 1:($4 - f(xtim($0)))
Andy S. wrote:
> I wish there was some way to get the x time value. Is there
> already a way? - I was unable to puzzle one out...
The thing you're looking for is the timecolumn() function. It works
just like column() (which you know best in its shorthand form, $1), but
tries to figure out time/date data, too.
Get latest updates about Open Source Projects, Conferences and News.