I would like to be able to plot data 'real-time' using gnuplot Specifically, for example, I have a file "foo.st" which is a data file, separated by columns. The data in "foo.st" is collected real-time from live variables I would like to have gnuplot open and plotting the data from "foo.st" as its continuously recording data. Ideally I want the plot to show a "1 second" plot, then refresh showing the next "1 second" of data, then refresh again showing the next "1 second" of data ... Right now, I have a gnuplot script "foo.p" which reads:
我希望能够使用gnuplot来绘制数据“实时”,例如,我有一个文件“foo”。st是一个由列分隔的数据文件。“foo中的数据。st是从实时变量中实时收集的,我希望gnuplot打开并绘制来自“foo”的数据。st“作为它不断记录的数据。理想情况下,我希望这个图表显示一个“1秒”的图表,然后刷新显示下一个“1秒”的数据,然后刷新显示下一个“1秒”的数据……现在,我有一个gnuplot脚本“foo”。p”的是:
set autoscale
set xtic auto
set ytic auto
set title "Leg Position"
set xlabel "Time (sec)"
set ylabel "Position"
plot "foo.st" u 1:2,'' u 1:3,'' u 1:4,'' u 1:5,'' u 1:6,'' u 1:7
pause 1
replot
set xrange [1:2]
replot
pause 1
set xrange [2:3]
replot
pause 1
set xrange [3:4]
replot
...
Etc I keep having to redefine the xrange to show a 1 second frame of data and then run the replot command.
我一直需要重新定义xrange以显示1秒的数据帧,然后运行replot命令。
Can anyone offer any other suggestions to go about this?
有谁能提出其他的建议吗?
1 个解决方案
#1
2
gnuplot 4.6 intruduced loops (do while () {}
, do for ..
).
gnuplot 4.6入侵循环(do while () {}, do for .)。
If you cannot upgrade:
如果你不能升级:
if !exists("t") t=0
dt=1
set xr [t:t+dt]
plot "data"
pause 1
t=t+1
reread
But I'd recommend using a while
-loop.
但是我建议使用循环。
#1
2
gnuplot 4.6 intruduced loops (do while () {}
, do for ..
).
gnuplot 4.6入侵循环(do while () {}, do for .)。
If you cannot upgrade:
如果你不能升级:
if !exists("t") t=0
dt=1
set xr [t:t+dt]
plot "data"
pause 1
t=t+1
reread
But I'd recommend using a while
-loop.
但是我建议使用循环。