Martin
Martin

Reputation: 1177

How to average values over a period of time with gnuplot?

I have been polling one integer counter for a week with 1min interval, but I added a new value to log file only if the value had changed. Initial value of this counter was 0 and at the moment the value is 111440. Log file can be seen here. Now if I tried to plot this data with gnuplot in a way that y-axe holds the value of the integer and x-axe holds the value of the time in minutes, then I obviously end up with a graph like this:

enter image description here

I should have stored each value even if it's the same as the previous one. At the moment I have only 3279 values stored while I have polled the counter 10080 times.

However, is there a possibility to "stretch" or average those results over a period of 10080 minutes with gnuplot?

Upvotes: 0

Views: 1206

Answers (1)

andyras
andyras

Reputation: 15910

Unfortunately you have lost some statistical information by not including all the data points, but you can stretch the data like this

plot 'data.dat' u ($0*10080.0/3279.0):1

to fill the space.

Gnuplot can do averages (version 4.6.0 and up):

stats 'data.dat'
help stats

Upvotes: 3

Related Questions