数据文件中的gnuplot 3d时间动画 [英] Gnuplot 3d time animation from data file
问题描述
我意识到这也许是微不足道的,如果我有更多的时间,我自己可能会很轻松地解决它,但是我已经没时间了,我迫切需要尽快使此动画工作.
I realise this is perhaps trivial and if I had more time I'd probably easily deal with it myself, but I'm running out of time and I desperately need to get this animation working as soon as possible.
我有类型的数据文件
0 28.3976 25.1876 12.7771
0.03125 34.1689 21.457 9.70863
0.0625 35.7084 17.6016 5.03987
0.09375 34.3048 13.6718 1.45238
...
其中第一列应被视为时间(实际上,它是某些ODE系统的数字解决方案).现在.我需要的是最后三列的3d图动画,随着时间的推移,曲线会随着曲线移动.那可行吗?如果是这样,怎么办?我是一个完整的gnuplot初学者,但在Google周围闲逛并没有太大帮助.我将不胜感激任何帮助.干杯!
where the first column is meant to be treated as time (it is in fact a numerical solution to a certain ODE system). Now. what I need is an animation of a 3d plot of the last three columns tracing a curve as it moves around with time. Is that doable? If so, how? I'm a complete gnuplot beginner and googling around did not help much. I would hugely appreciate any help. Cheers!
推荐答案
以下内容应为您显示动画情节:
The following should show you an animated plot:
# define fixed axis-ranges
set xrange [-1:1]
set yrange [0:20]
set zrange [-1:1]
# filename and n=number of lines of your data
filedata = 'data.dat'
n = system(sprintf('cat %s | wc -l', filedata))
do for [j=1:n] {
set title 'time '.j
splot filedata u 2:3:4 every ::1::j w l lw 2, \
filedata u 2:3:4 every ::j::j w p pt 7 ps 2
}
splot命令的第一行绘制出托盘区域,第二行绘制出当前时间的点.
The first line of the splot command plots the trayectory, and the second line plots the point at the current time.
如果需要此输出的gif,只需在for循环之前添加以下内容:
If you want a gif of this output, simply add the following before the for-loop:
set term gif animate
set output 'output.gif'
这是示例输出:
相关:
这篇关于数据文件中的gnuplot 3d时间动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!