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