File: ex4.pl

package info (click to toggle)
libchart-strip-perl 1.08-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 216 kB
  • ctags: 39
  • sloc: perl: 1,105; makefile: 6
file content (40 lines) | stat: -rw-r--r-- 818 bytes parent folder | download | duplicates (8)
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
34
35
36
37
38
39
40
#!/usr/local/bin/perl
# -*- perl -*-

use Chart::Strip;

my $img = Chart::Strip->new( title => 'Alien Experimentation on the Population of New England' );

my( $data );

$data = [];
for(my $t=10; $t<210; $t+=15){

    push @$data, {
	time  => $^T + $t  * 5000,
	value => cos( $t/30 ),
	min   => 0,
	diam  => 10 * (-cos( $t/30 ) + 1.5),
    };
}

$img->add_data( $data, {style => 'range', color => '00FFFF' } );
$img->add_data( $data, {style => 'points', color => '0000FF' } );

$data = [];
for(my $t=10; $t<210; $t+=15){

    push @$data, {
	time  => $^T + $t  * 5000,
	value => cos( $t/30 + 1.5 ),
	min   => 0,
	diam  => 10 * (cos( $t/30 + 1.5 ) + 1.5),
    };
}

$img->add_data( $data, {style => 'range', color => 'FF00FF' } );
$img->add_data( $data, {style => 'points', color => '00FF00' } );



print $img->png();