use strict;
use warnings;
use Data::Dumper;
use 5.010;
use GD::Graph::histogram;
use YAML;
use CGI ':standard';
sub main {
my $input = 'distance.txt';
unless(open(INPUT, $input)) {
die "\nCannot open input\n";
}
my @data;
while(my $line = ) {
chomp $line;
my @rounded = sprintf ("%.1f\n", $line);
push @data, @rounded;
my ( $filename, @data ) = @_;
my $graph = new GD::Graph::histogram(400,600);
$graph->set(
y_label => 'Count',
x_label => 'Distances',
title => 'Histogram',
x_labels_vertical => 1,
bar_spacing => 0,
shadow_depth => 1,
shadowclr => 'dred',
transparent => 0,
)
or warn $graph->error;
my $image = $graph->plot(\@data) or die $graph->error;
open( IMG, '>' . $filename ) or die $!;
binmode IMG;
print IMG $image->png;
}
}
main();
####
Subroutine main::Dump redefined at /System/Library/Perl/5.18/CGI.pm line 308.
Use of uninitialized value $min in subtraction (-) at /Library/Perl/5.18/GD/Graph/histogram.pm line 110, line 1.
Use of uninitialized value $max in subtraction (-) at /Library/Perl/5.18/GD/Graph/histogram.pm line 110, line 1.
Use of uninitialized value $max in numeric le (<=) at /Library/Perl/5.18/GD/Graph/histogram.pm line 118, line 1.
Use of uninitialized value $upper in numeric le (<=) at /Library/Perl/5.18/GD/Graph/histogram.pm line 118, line 1.
Use of uninitialized value $lower in addition (+) at /Library/Perl/5.18/GD/Graph/histogram.pm line 119, line 1.
Use of uninitialized value $max in numeric le (<=) at /Library/Perl/5.18/GD/Graph/histogram.pm line 122, line 1.
Use of uninitialized value in string eq at /Library/Perl/5.18/GD/Graph/histogram.pm line 42, line 1.
Use of uninitialized value in subtraction (-) at /Library/Perl/5.18/GD/Graph/histogram.pm line 59, line 1.
Use of uninitialized value in addition (+) at /Library/Perl/5.18/GD/Graph/histogram.pm line 59, line 1.
Use of uninitialized value $filename in concatenation (.) or string at /Users/Joshua/eclipse-workspace/PlottingPoints/Histogram line 40, line 1.
No such file or directory at /Users/Joshua/eclipse-workspace/PlottingPoints/Histogram line 40, line 1.