File: sample55.pl

package info (click to toggle)
libgd-graph-perl 1.33-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 480 kB
  • ctags: 188
  • sloc: perl: 3,677; makefile: 83
file content (33 lines) | stat: -rw-r--r-- 663 bytes parent folder | download
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
26
27
28
29
30
31
32
33
use strict;
use GD::Graph::lines;
require 'save.pl';
use constant PI => 4 * atan2(1,1);

print STDERR "Processing sample 5-5\n";

my @x = map {$_ * 3 * PI/100} (0 .. 100);
my @y = map sin, @x;
my @z = map cos, @x;

my @data = (\@x,\@y,\@z);

my $my_graph = new GD::Graph::lines();

$my_graph->set(
	x_label 			=> 'Angle (Radians)',
	y_label 			=> 'Trig Function Value',
	x_tick_number 		=> 'auto',
	y_tick_number 		=> 'auto',
	title 				=> 'Sine and Cosine',
	line_width 			=> 1,
	x_label_position 	=> 1/2,
	r_margin 			=> 15,

	transparent 		=> 0,
);

$my_graph->set_legend('Thanks to Scott Prahl');

$my_graph->plot(\@data);
save_chart($my_graph, 'sample55');