Histogram graph/Statistical analysis by PDL
Use the histogram method to draw a histogram graph in PDL::Graphics::PLplot .
[f: id: perlcodeexample: 20131107121226p: image: w500]
use strict; use warnings; use PDL; use PDL::Graphics::PLplot; # Create PLPlot object my $pl = PDL::Graphics::PLplot->new(DEV =>'png', FILE =>'graph.png'); # x value my $x = pdl [1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 5, 5, 5, 6, 7, 7, 7, 7, 8, 8, 10] ; my $bin_count = 5; # Create a histogram graph $pl->histogram( $x, $bin_count, BOX => [0, 10, 0, 20], TITLE =>'histogram' ); # Close $pl->close;