在窗口关闭的Gnuplot出口

wor*_*nga 5 gnuplot

我使用以下脚本从.csv文件打印读数.绘图每秒刷新一次,以在模拟运行时显示新数据.这有点好看,虽然有点难看,因为重读整个数据集(如果你有更好的解决方案,请告诉我)

但是,当我关闭gnuplot窗口时,脚本不会退出,但是暂停1秒后会出现一个新窗口,这有点烦人.关闭窗口后,我宁愿关闭脚本.有办法实现这个吗?

#!/usr/bin/gnuplot
set t wxt enhanced noraise
set datafile separator ";"
plot "../build/inputLink.csv" using 1:5 title 'Input Gear' with lines ,\
     "../build/inputLink.csv" using 1:7 title 'Input Gear Ratio' with lines,\
     ;
pause 1
reread
Run Code Online (Sandbox Code Playgroud)

Chr*_*oph 5

gnuplot 中并没有这样的功能,可以绑定窗口的close按钮来退出程序。但是,您可以使用bind定义退出循环的热键:

#!/usr/bin/gnuplot
set t wxt enhanced noraise
set datafile separator ";"
set style data lines

done = 0
bind all 'd' 'done = 1'
while(!done) {
  plot "../build/inputLink.csv" using 1:5 title 'Input Gear',\
       "" using 1:7 title 'Input Gear Ratio'
  pause 1
}
Run Code Online (Sandbox Code Playgroud)

不,除了每次重新读取整个数据集之外,没有其他方法可以刷新绘图。