use GD::Graph::hbars; use strict; use warnings; my @data = ( ['Jan', 'Feb', 'Mar', 'Apr'], [5, 7, 9, 6], [2, 2, 3, 1], [4, 4, 6, 3], ); my @legend = qw(maximum minimum average); my $graph = GD::Graph::hbars->new(600, 500); $graph->set ( x_label => 'Month', y_label => 'Value', title => 'GD::Graph::hbars example', bar_spacing => 6, show_values => 1, legend_placement => 'BL', legend_spacing => 5, show_values => 1, legend_marker_height => 12, dclrs => [ qw(orange cyan lred) ], ) or warn $graph->error; $graph->set_legend(@legend); my $gd = $graph->plot(\@data) or warn $graph->error; open(IMG, ">graph.png") or die $!; binmode IMG; print IMG $gd->png; close IMG;