I've never had any luck using xdata, ydata, zdata for 3D plots; I can't work out what's supposed to be in each array, and the documentation isn't helpful.
For 3D plots, I always use points instead - you may have to munge the data in Perl a bit first, but at least it works. The following is an example based on the 'Valley of the Gnu' data in the Gnuplot manual:
use strict; use warnings; use Chart::Gnuplot; my (@x,@y,@data); #data is initialized. @data = ( [0, 0, 10], [0, 1, 10], [0, 2, 10], [1, 0, 10], [1, 1, 5], [1, 2, 10], [2, 0, 10], [2, 1, 1], [2, 2, 10], [3, 0, 10], [3, 1, 0], [3, 2, 10], ); my $chart = Chart::Gnuplot->new( output => "test1.png", title => "3D plot from arrays of x, y and z coordinates", xlabel => 'x', ylabel => 'y', ); #$chart->set(view => (180,180,1,1'); + my $dataSet = Chart::Gnuplot::DataSet->new( points => \@data, ); $chart->plot3d($dataSet);
Where the 3 element array refs are [xcoord, ycoord, zcoord] and the x's are fixed while you iterate through the y's
In reply to Re: 2d contour plot using Chart::Gnuplot
by Myrddin Wyllt
in thread 2d contour plot using Chart::Gnuplot
by Ppeoc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |