如何更改动态运行时更改数据的gnuplot中的x轴窗口范围。目前我的范围显示从0到t的窗口大小,其中t保持增加。但我希望范围是[t - 2000,t]。我一直在研究如何使用xrange,但无法使其正常工作。
我也查看了链接,但它没有帮助。 Dynamically changing the range of a histogram in gnuplot?
任何帮助都将不胜感激。谢谢
答案 0 :(得分:1)
您可以在脚本中绘制两次数据文件,在第一个(虚拟)绘图之后,变量GNUPLOT_DATA_X_MAX
包含其名称所示的内容。
或者您在绘图之前对数据使用stats
命令,之后会有一个变量STATS_max_x
,可用于设置绘图的所需范围。
答案 1 :(得分:0)
在linux中,您可以使用tail
命令获取文件的最后2000行:
tail -n2000 file.dat # if data is sorted
sort file.dat | tail -n2000 # if data is not sorted
这些命令的输出可以在gnuplot中绘制为:
plot "< tail -n2000 file.dat"
plot "< sort file.dat | tail -n2000"
这相当于绘制[xmax-2000:xmax]
范围内的数据。
在Windows中,存在Sort
命令,Windows Server 2003 Resource Kit Tools中有Tail
命令。您还可以从包GNUWin32下载Windows的unix-commands。调用这些程序的语法与我上面描述的类似。