#!/usr/bin/perl -w
use strict;
use Chart::Gnuplot;
# Create the chart object
my $chart = Chart::Gnuplot->new(
output => "legend_4.png",
legend => {
border => {
linetype => 2,
width => 2,
color => "navy",
},
},
);
# Data set 1
my $data1 = Chart::Gnuplot::DataSet->new(
func => "cos(x)",
title => "cosine",
);
# Data set 2
my $data2 = Chart::Gnuplot::DataSet->new(
func => "sin(x)",
title => "sine",
);
# Data set 3
my $data3 = Chart::Gnuplot::DataSet->new(
func => "-0.002 * x**3",
title => "cubic",
);
# Plot the graph
$chart->plot2d($data1, $data2, $data3);