#!/usr/bin/perl -w
use strict;
use Chart::Gnuplot;
# Initiate the chart object
my $chart = Chart::Gnuplot->new(
output => 'plotStyle_19.png',
yrange => [0, '*'],
);
# DataSet object of the 1st data set
# - Data input as "xdata" and "ydata"
my @x = qw(A B C D E F);
my $h1 = Chart::Gnuplot::DataSet->new(
xdata => \@x,
ydata => [1, 8, 3, 2, 4, 4],
title => "1st data set",
style => "histograms",
);
# DataSet object of the 2nd data set
# - Fill the bars
my $h2 = Chart::Gnuplot::DataSet->new(
xdata => \@x,
ydata => [2, 2, 5, 1, 7, 6],
title => "2nd data set",
color => "dark-green",
fill => {density => 0.2},
style => "histograms",
);
# DataSet object of the 3rd data set
# - Data input as "points"
my $h3 = Chart::Gnuplot::DataSet->new(
points => [
['A', 4],
['B', 3],
['C', 2],
['D', 2],
['E', 3],
['F', 5],
],
title => "3rd data set",
style => "histograms",
);
# Plot the graph
$chart->plot2d($h1, $h2, $h3);