use strict; use warnings; use Chart::Gnuplot; my (@x,@y,@data); #data is initialized. my $chart = Chart::Gnuplot->new( output => "test1.png", title => "3D plot from arrays of x, y and z corrdinates", xlabel => 'x', ylabel => 'y', ); $chart->set(view => '180,180,1,1'); my $dataSet = Chart::Gnuplot::DataSet->new( xdata => \@x, ydata => \@y, zdata => \@data, ); $chart->plot3d($dataSet);