File: plot3d_2.pl

package info (click to toggle)
libchart-gnuplot-perl 0.23-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 944 kB
  • sloc: perl: 4,862; makefile: 113
file content (25 lines) | stat: -rwxr-xr-x 427 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl -w
use strict;
use Chart::Gnuplot;

# Input data source
my @points = ();
for (my $x = -5; $x < 5; $x += 0.02)
{
	my $y = sin($x*3);
	my $z = cos($x*3);

	push(@points, [$x, $y, $z]);
}

my $chart = Chart::Gnuplot->new(
    output => "gallery/plot3d_2.png",
    title  => "3D plot from Perl array of points",
);


my $dataSet = Chart::Gnuplot::DataSet->new(
    points => \@points,
);

$chart->plot3d($dataSet);