#!/usr/bin/perl -w use strict; use Chart::Gnuplot; # Prepare data to plot my @x = (1 .. 7); my (@y1, @y2) = (); for (my $i = 0; $i < @x; $i++) { my $y1 = sqrt($x[$i]) + 1.5*(rand()-0.5); my $y2 = sqrt($x[$i]) + 1.5*(rand()-0.5); push(@y1, $y1); push(@y2, $y2); } # Chart object my $chart = Chart::Gnuplot->new( output => "line.png", xrange => [0, 8], yrange => [0, 4], imagesize => "0.45,0.45", ); # DataSet object of Line A my $lineA = Chart::Gnuplot::DataSet->new( xdata => \@x, ydata => \@y1, style => "lines", color => "#DD8888", width => 5, ); # DataSet object of Line B my $lineB = Chart::Gnuplot::DataSet->new( xdata => \@x, ydata => \@y2, style => "lines", color => "#88DD88", width => 5, ); # Plot the graph $chart->plot2d($lineA, $lineB);