in reply to 2d contour plot using Chart::Gnuplot
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: 2d contour plot using Chart::Gnuplot
by Ppeoc (Beadle) on Mar 02, 2016 at 14:36 UTC | |
by BrowserUk (Patriarch) on Mar 02, 2016 at 22:44 UTC | |
by Myrddin Wyllt (Hermit) on Mar 03, 2016 at 14:34 UTC | |
by Ppeoc (Beadle) on Mar 03, 2016 at 17:41 UTC | |
by Lotus1 (Vicar) on Mar 04, 2016 at 19:48 UTC | |
by poj (Abbot) on Mar 04, 2016 at 19:54 UTC | |
by Lotus1 (Vicar) on Mar 04, 2016 at 20:04 UTC | |
by RonW (Parson) on Mar 03, 2016 at 02:10 UTC | |
by Lotus1 (Vicar) on Mar 02, 2016 at 15:55 UTC |