Search notes:

Perl module GD::Graph::histogram

GD::Graph::histogram allows to draw histograms with Perl.
#!/usr/bin/perl
use warnings;
use strict;

use GD::Graph::histogram;

my $data = [1,5,7,8,5,9,14,22,10,15,11,17,4,6,8,9,2,20,7,12,8,12,8,13,18,3,5,3,4,5,13,5,3,10,7,5,2,2,6];

my $graph = GD::Graph::histogram->new(400,400);

 $graph->set(
         x_label           => 'X Label',
         y_label           => 'Count',
         title             => 'A Simple Count Histogram Chart',
         x_labels_vertical =>  1,
         bar_spacing       => 10,
         histogram_bins    => 10,
#        histogram_type    =>'count',
         transparent       =>  0,
        )
        or warn $graph->error;

my $gd = $graph->plot($data) or die $graph->error;

open my $png, '>', 'plot.png';
binmode $png;
print $png $graph->gd->png;
close $png;
Github repository PerlModules, path: /GD/Graph/histogram/script.pl
The script above produces something like

See also

GD::Graph::bars
Perl modules
R function hist, R data-visualization: histograms
Histogram

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759191663, '216.73.216.128', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Perl/modules/GD/Graph/histogram/index(80): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78