1use strict; 2use GD::Graph::histogram; 3 4my @data; 5for (my $i = 0; $i < 100; $i++) 6{ 7 push(@data, rand(50)); 8} 9 10my $graph = new GD::Graph::histogram(450,450); 11 12$graph->set( 13 x_label => 'Jelly Beans', 14 y_label => 'Count', 15 title => 'A Simple Count Histogram Chart', 16 x_labels_vertical => 1, 17 bar_spacing => 0, 18 shadow_depth => 1, 19 shadowclr => 'dred', 20 transparent => 0, 21 ) 22 or warn $graph->error; 23 24my $gd = $graph->plot(\@data) or die $graph->error; 25 26open(IMG, '>file.png') or die $!; 27binmode IMG; 28print IMG $gd->png; 29