#!/usr/bin/perl -w use strict; use Chart::Gnuplot; # Create the chart object my $chart = Chart::Gnuplot->new( output => "animation.gif", imagesize => '320,220', ); my $T = 50; # number of frames my @c; for (my $i = 0; $i < $T; $i++) { $c[$i] = Chart::Gnuplot->new(); my $ds = Chart::Gnuplot::DataSet->new( func => "sin($i*2*pi/$T + x)", ); $c[$i]->add2d($ds); } $chart->animate( charts => \@c, delay => 2, # default is 5 );