#!/usr/bin/perl -w
use strict;
use Chart::Gnuplot;
# Prepare data to plot
my @x = (1 .. 5);
my @y = ();
for (my $i = 0; $i < @x; $i++)
{
my $y = sqrt($x[$i]) + (rand()-0.5);
push(@y, $y);
}
# Chart object
my $chart = Chart::Gnuplot->new(
output => "impulse.png",
xrange => [0, 6],
yrange => [0, 3],
imagesize => "0.45,0.45",
);
# DataSet object
my $data = Chart::Gnuplot::DataSet->new(
xdata => \@x,
ydata => \@y,
style => "impulses",
color => "#DD8888",
width => 5,
);
# Plot the graph
$chart->plot2d($data);