Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make movie with data files using gnuplot

Tags:

c++builder

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

like image 546
nagendra Avatar asked Jan 18 '11 20:01

nagendra


People also ask

How use gnuplot data file?

To plot functions simply type: plot [function] at the gnuplot> prompt. Discrete data contained in a file can be displayed by specifying the name of the data file (enclosed in quotes) on the plot or splot command line. Data files should have the data arranged in columns of numbers.

What files can gnuplot open?

Gnuplot can read binary data files. However, adequate information about details of the file format must be given on the command line or extracted from the file itself for a supported binary filetype. In particular, there are two structures for binary files, a matrix binary format and a general binary format.

Is there a GUI for gnuplot?

There is also a graphical user interface (GUI) for gnuplot .

Is gnuplot easy?

gnuplot is a not-quite-as-easy-to use, though extremely powerful, command-line plotting program. Running gnuplot is easy: from a command prompt on any system, type gnuplot. It is even possible to do this over a telnet or ssh connection, and preview the graphs in text mode!


1 Answers

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.

like image 138
jarondl Avatar answered Sep 22 '22 08:09

jarondl