plot (and watch) a data movie in gnuplot

Imagine you have  a data file with some parameter changing. And a 2d plot corresponding to each value of this parameter.

Now say, you save a data file data.txt, with multiple blocks(each block should be separated from each other by a single line). And each block corresponds to a unique value of that parameter.

Now you want to see live, how the two d plot changes with this parameter slowly changing. (this parameter could very well be time)

The do for loop in gnuplot is very powerful..

say ‘a’ was that parameter

the every command chooses block by block

pause command waits for 0.5 seconds (can be tuned)

save the following commands in a file and run it using gnuplot.

In order to make  a movie one can save each of these files and then make movie using other software

———————–

do for [a=1:100] {
pl ‘./data.txt’ u 1:2:3 every :::a::a w p pt 7 palette
pause 0.5
}

—————————

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s