#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Chart::Gnuplot; # Data my @x = (-10 .. 10); my @y = (0 .. 20); # Create chart object and specify the properties of the chart my $chart = Chart::Gnuplot->new( output => "fig/simple.png", title => "Simple testing", xlabel => "My x-axis label", ylabel => "My y-axis label", ); # Create dataset object and specify the properties of the dataset my $dataSet = Chart::Gnuplot::DataSet->new( xdata => \@x, ydata => \@y, title => "Plotting a line from Perl arrays", style => "linespoints", ); # Plot the data set on the chart $chart->plot2d($dataSet); __END__ $ perl test.pl $ ls -la fig | grep simple -rw-rw-r-- 1 tinyos tinyos 9401 Feb 1 19:18 simple.png