Sunday, May 15, 2011

Creating animated SVG plots with GNU Octave and gnuplot

It's relatively easy to create an animated plot as either a video (AVI, MPEG, ...) file or an animated GIF file via GNU Octave or gnuplot -- one needs only to create a sequence of images and then use a tool like mencoder or ffmpeg to combine these into a single video file.

But how about an animated SVG file? As plots are vector by nature, an animated vector file sounds cool. Gnuplot is capable of producing output graphs in SVG format, but I was not successful in finding a way of converting these into a single animated SVG.

So I hacked together something for the task. If you have a recent-enough browser (tested in Firefox 4.0.1 and Chromium 11.0.696.65) you can have a look at a trivial example.
If you're interested, grab the scripts here: ani-plot