line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
1590
|
use GD::Graph::lines; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
require 'save.pl'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
print STDERR "Processing sample54\n"; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my $path = $ENV{GDGRAPH_SAMPLES_PATH} ? $ENV{GDGRAPH_SAMPLES_PATH} : ''; |
7
|
|
|
|
|
|
|
@data = read_data("${path}sample54.dat") |
8
|
|
|
|
|
|
|
or die "Cannot read data from ${path}sample54.dat"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$my_graph = new GD::Graph::lines(); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$my_graph->set( |
13
|
|
|
|
|
|
|
x_label => 'Wavelength (nm)', |
14
|
|
|
|
|
|
|
y_label => 'Absorbance', |
15
|
|
|
|
|
|
|
title => 'Numerical X axis', |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
y_min_value => 0, |
18
|
|
|
|
|
|
|
y_max_value => 2, |
19
|
|
|
|
|
|
|
y_tick_number => 8, |
20
|
|
|
|
|
|
|
y_label_skip => 4, |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
x_tick_number => 'auto', |
23
|
|
|
|
|
|
|
x_label_skip => 2, |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
box_axis => 0, |
26
|
|
|
|
|
|
|
line_width => 2, |
27
|
|
|
|
|
|
|
x_label_position => 1/2, |
28
|
|
|
|
|
|
|
r_margin => 15, |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
x_labels_vertical => 1, |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
transparent => 0, |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$my_graph->set_legend('Thanks to Scott Prahl'); |
36
|
|
|
|
|
|
|
$my_graph->plot(\@data); |
37
|
|
|
|
|
|
|
save_chart($my_graph, 'sample54'); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub read_data |
41
|
|
|
|
|
|
|
{ |
42
|
|
|
|
|
|
|
my $fn = shift; |
43
|
|
|
|
|
|
|
my @d = (); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
open(ZZZ, $fn) || return (); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
while () |
48
|
|
|
|
|
|
|
{ |
49
|
|
|
|
|
|
|
chomp; |
50
|
|
|
|
|
|
|
my @row = split; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
for (my $i = 0; $i <= $#row; $i++) |
53
|
|
|
|
|
|
|
{ |
54
|
|
|
|
|
|
|
undef $row[$i] if ($row[$i] eq 'undef'); |
55
|
|
|
|
|
|
|
unshift @{$d[$i]}, $row[$i]; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
close (ZZZ); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
return @d; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |