views:

1499

answers:

4

I am a big fan of Gnuplot and I used it all along my studies for various projects.

Lately I wanted to use Gnuplot to chart some time series like weight loss, exercising results, gas consumptions etc.

Therefore I scale the x-axis like

set xdata time
set timefmt "%d.%m %Y"
set format x "%d.%m"

Now I want to use the fit-function to give me a linear fit. My problem is, that I cannot get that to work if the x-axis is time-related.

+2  A: 

You could use another tool to calculate the regression function and plot the output of that. Some possibilities are: R, |stat or the statistical functions of various spreadsheets. This link has a list of free statistics software.

ConcernedOfTunbridgeWells
+1  A: 

Then change the date to a number, for example a number of days starting from the first date, make the fit, and then convert the numbers back again into dates. That way you'll have "regular" x and y data set.

ldigas
+2  A: 

R is probably a better tool for this kind of problem. It is one of most popular languages for data analysis. Plotting is as simple (or simpler) as in gnu plot.

Łukasz Lew
+1  A: 

Another good alternative to gnuplot is matplotlib. It's a set of Python libraries for reading, manipulating, and graphing points. They have a nice cookbook at scipy.org, and here's the entry for linear regressions.

slacy