#!/usr/bin/perl -w use strict; use Chart::Gnuplot; # Create the chart object my $chart = Chart::Gnuplot->new( output => "animation_3.gif", title => "Rotating sphere", ); my $T = 80; # number of frames my @c; for (my $i = 0; $i < $T; $i++) { $c[$i] = Chart::Gnuplot->new(); my $ds = Chart::Gnuplot::DataSet->new( func => { x => "sin(u)*cos(v + $i*2*pi/$T)", y => "sin(u)*sin(v + $i*2*pi/$T)", z => "cos(u)", }, ); $c[$i]->add3d($ds); } $chart->animate( charts => \@c, delay => 10, # rotate faster than default );