Make movie with data files using gnuplot

社会主义新天地 提交于 2019-12-09 04:46:51

问题


I do have many data files. They look like 1.dat 2.dat .... .... 1000.dat

I want to make a movie using these files plotting them in sequence. Does anyone have any idea please? It would be my great pleasure if you can help me. ND


回答1:


You need two steps here. The first one is to create jpeg or png plots from the data. I do not know what your data looks like, but I guess you've already found out how to plot it with gnuplot. Gnuplot has a loop option, but if you're on a linux box, you can easly pass all the files to gnuplot as arguments for example, run the following in bash:

for i in {1..1000}
do
   gnuplot "What needs to be done" $i.dat
done

Now, you need to create your movie. The easiest way would be:

ffmpeg -i gnuplotoutput%04d.jpeg movie.mpeg

Edit: After your clarification (the data is 3d etc):

for i in {1..1000}
do
   gnuplot -e "set terminal jpeg; splot '$i.dat'" > pic$i.jpeg
done

ffmpeg -i pic%04d.jpeg movie.mpeg

Indeed, the idea was that "what needs to be done " will be replaced by your own commands. gnuplot is exceptionally capable, but you need to tell it exactly what to do. That depends on your data, and what output you want. I've used splot, to create a 3d grid graph.



来源:https://stackoverflow.com/questions/4728708/make-movie-with-data-files-using-gnuplot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!