Plotting many data files and creating an animation in gnuplot
Say, you have many files with two columns of data. If we want to plot the data in each file in a separate plot, it will take a lot of time do it manually one by one. But using a simple shell script, this can be done at once.
Let the files be named as data1, data2, data3, …, dataN. An example shell script plot for doing this looks like:
This script is assuming that all the data files are in the same location as the script file. Also it creates png figures with the same name as data files. Replace N with the number of the last file. For running this script in terminal, you have to enter the command,
For creating an animation from the plots created as above, we need the image editing software GIMP.
Steps:
-
Open GIMP
-
File > Open as layers
-
Select all the plotted figures and open
-
File > Save as
-
Choose GIF and enter a name for the animation
-
Select ‘Save as animation’ when prompted
-
You can specify some parameter of the animation in this window. Like delay between frames, loop forever, etc. Default choices are okay for most purposes.
-
Enjoy !!