use strict; use Chart::Gnuplot; # Date array my @x = qw( 2007-01-01 2007-01-10 2007-01-24 2007-02-01 2007-02-14 ); my @b = ([1, 2, 3, 4, 5], [6, 7, 8, 9, 10]); my @p; my @n; # Create the chart object my $chart = Chart::Gnuplot->new( output => 'datetime_1.png', xlabel => 'Date axis', timeaxis => "x", ); # Data set object for my $i ( 1 .. 1) { @n = (); for my $j ( 0 .. $#{$b[$i]}) { print "b[$i][$j] is $b[$i][$j]\n"; push(@n,$b[$i][$j]); } my $plot = Chart::Gnuplot::DataSet->new( xdata => \@x, ydata => \@n, style => 'linespoints', timefmt => '%Y-%m-%d', ); $chart->plot2d($plot); } #### $chart->plot2d($val1) if $val == 1; $chart->plot2d($val1,$val2) if $val == 2; $chart->plot2d($val1,$val2,$val3) if $val == 3; etc...