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