#!/usr/bin/perl -w
use strict;
use Chart::Gnuplot;
# Create the chart object
my $chart = Chart::Gnuplot->new(
output => "polar.png",
polar => '',
grid => 'polar',
border => undef,
xtics => undef,
ytics => undef,
size => 'square',
imagesize => "0.45,0.45",
);
# Data in polar corrdinates
my (@t, @r) = ();
for (my $t = 0; $t < 20; $t += 0.02)
{
my $r = sin(5*$t)*sqrt($t);
push(@t, $t);
push(@r, $r);
}
# Data set object
my $dataSet = Chart::Gnuplot::DataSet->new(
xdata => \@t,
ydata => \@r,
style => 'lines',
);
# Plot the graph
$chart->plot2d($dataSet);