GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
GD::Graph::histogram(3) User Contributed Perl Documentation GD::Graph::histogram(3)

GD::Graph::histogram - Histogram plotting module for Perl5

  use GD::Graph::histogram;

GD::Graph::histogram extends the GD::Graph module to create histograms. The module allow creation of count or percentage histograms.

Fill an array with all the data values that are to be plotted. Note that GD::Graph::histogram unlike the other GD::Graph modules can only plot one data set at a time.

        $data = [1,5,7,8,9,10,11,3,3,5,5,5,7,2,2];

Create the graph

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

Set graph options

        $graph->set( 
                x_label         => 'X Label',
                y_label         => 'Count',
                title           => 'A Simple Count Histogram Chart',
                x_labels_vertical => 1,
                bar_spacing     => 0,
                shadow_depth    => 1,
                shadowclr       => 'dred',
                transparent     => 0,
        ) 
        or warn $graph->error;

plot the graph

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

save the graph to a file

        open(IMG, '>histogram.png') or die $!;
        binmode IMG;
        print IMG $gd->png;

GD::Graph::histogram supports all the methods support by GD::Graph. Please refer to the GD::Graph documentation for more information.

The only method that behaves differently is plot

The plot method provided by GD::Graph::histogram expects a reference to an array of numbers.

Based on the input data, GD::Graph::histogram will generate the appropriate labels for the X axis. The X axis label represent the center point of the range of each histogram bin.

GD::Graph::histogram supports all the options supported by GD::Graph::bars. Please refer to the GD::Graph documentation for more information.

The two additional options that are specific to GD::Graph::histogram are:

        histogram_bins
                Specify the number of histogram bins to bucket the data into.
                The default is for the module to automatically computed the
                histogram bins based on the data.

        histogram_type
                Can be set to either 'percentage' or 'count'. By default the module
                will create 'count' histograms.

As with all Modules for Perl: Please stick to using the interface. If you try to fiddle too much with knowledge of the internals of this module, you could get burned. I may change them at any time.

        Snehanshu Shah
        perl@whizdog.com
        http://www.whizdog.com

Thanks for all the feedback, bug reports and bug fixes

Martin Corley Jonathan Barber William Miller

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

perl(1), GD::Graph
2006-03-22 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.