#!/usr/bin/perl -w
use strict;
use Chart::Gnuplot;
# Prepare data to plot
my @x = (1 .. 7);
my @pt = ();
for (my $i = 0; $i < @x; $i++)
{
my $y = sqrt($x[$i]) + 1.5*(rand()-0.5);
my $s = rand();
push(@pt, [$x[$i], $y, $s])
}
# Chart object
my $chart = Chart::Gnuplot->new(
output => "bubble.png",
xrange => [0, 8],
yrange => [0, 4],
imagesize => "0.45,0.45",
);
# DataSet object
my $data = Chart::Gnuplot::DataSet->new(
points => \@pt,
style => "circles",
color => "#DD8888",
fill => {density => 0.4},
width => 2,
);
# Plot the graph
$chart->plot2d($data);