Chart-GGPlot

 view release on metacpan or  search on metacpan

lib/Chart/GGPlot/Stat/Bin.pm  view on Meta::CPAN

package Chart::GGPlot::Stat::Bin;

# ABSTRACT: Statistic method that gets histogram of data

use Chart::GGPlot::Class qw(:pdl);
use namespace::autoclean -except => 'stat';
use MooseX::Singleton;

our $VERSION = '0.002003'; # VERSION

use PDL::Primitive qw(which);
use POSIX qw(floor);

use Chart::GGPlot::Aes::Functions qw(aes);
use Chart::GGPlot::Bins;
use Chart::GGPlot::Layer;
use Chart::GGPlot::Util qw(call_if_coderef seq_n stat);
use Chart::GGPlot::Util::Pod qw(layer_func_pod);

with qw(
  Chart::GGPlot::Stat
);

has '+default_aes' => (
    default => sub {
        aes(
            y      => q{stat($count)},
            weight => 1,
        );
    }
);

classmethod required_aes () { ['x'] }

classmethod _parameters () {
    [
        qw(
          na_rm
          bins binwidth boundary breaks center pad
          )
    ]
}

my $stat_bin_pod = layer_func_pod(<<'EOT');

        stat_bin(:$mapping=undef, :$data=undef,
                 :$geom="bar", :$position="stack",
                 :$binwidth=undef, :$bins=undef,
                 :$center=undef, :$boundary=undef, :$breaks=undef,
                 :$pad=false,
                 :$na_rm=false, :$show_legend='auto', :$inherit_aes=true,
                 %rest)

    Arguments:

    =over 4

    %TMPL_COMMON_ARGS%

    =item * $binwidth

    The width of the bins.
    Can be specified as a numeric value, or a function that calculates width
    from x. The default is to use C<$bins> bins that cover the range of the
    data.

    =item * $bins

    Number of bins. Overridden by C<$binwidth>. Defaults to 30.

    You should always override this C<$bins> or C<$binwidth>, exploring
    multiple widths to find the best to illustrate the stories in your data.

    =back

EOT

my $stat_bin_code = fun (
    :$mapping=undef, :$data=undef,
    :$geom="bar", :$position="stack",
    :$binwidth=undef, :$bins=undef,
    :$center=undef, :$boundary=undef, :$breaks=undef,
    :$pad=false,
    :$na_rm=false,
    :$show_legend='auto', :$inherit_aes=true,
    %rest )
{                           



( run in 1.111 second using v1.01-cache-2.11-cpan-39bf76dae61 )