Viktor Scherf
Viktor Scherf

Reputation: 33

Gnuplot plot points in certain interval with autoupdate

Say, I have a large data file that starts at index 1 and ends at more than 10000, like this:

1 -35000    44312   53750   97500   67687   5000    1.64    
2  33500    -12937  -68000  -37250  -35937  -96750  1.64    
3 -37750    43125   53500   95250   66937   4500    1.64    
4  29000    -15437  -69000  -39750  -36562  -97250  1.64    
5 -39000    43062   52250   93000   65750   3750    1.64    
.
.
.   
100000 29250    -14250  -69250  -41500  -37500  -98000  1.64

I use this command to monitor the data online:

plot 'data.raw' using 0:3 title 'Reference' w lp ls 1, \
'data.raw' using 0:7 title 'Temperature' w lp ls 7
set xrange [0: ]
pause 0.5
replot
reread

As the data points increases, I barely see a change in the graph, because I plot the whole file from X=0. How can I plot a certain interval only, e.g. deltaX = 300 points with autoupdate? So I would then see practically 0-300, 300-600, and so on in plot window of Gnuplot. Thank You!

Upvotes: 2

Views: 487

Answers (1)

Miguel
Miguel

Reputation: 7627

Not sure if this is what you're after. Say that I have some data file with 1000 entries (generated with bash):

for i in `seq 1 1 1000`; do echo $i $RANDOM >> data; done

Now I plot in intervals of 100 points and visualize each interval during 2 second:

do for [i=1:10] {
set xrange[100*(i-1):100*i]
set title "Interval no. ".i
plot "data" w l
pause 2
}

This looks like so:

enter image description here

Upvotes: 0

Related Questions