NAME

Chart::GGPlot::Stat::Functions - Function interface for stats

VERSION

version 0.002003

DESCRIPTION

FUNCTIONS

stat_bin

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:

  • $mapping

    Set of aesthetic mappings created by aes(). If specified and $inherit_aes is true (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

  • $data

    The data to be displayed in this layer. If undef, the default, the data is inherited from the plot data as specified in the call to ggplot().

  • $stat

    The statistical transformation to use on the data for this layer, as a string.

  • $position

    Position adjustment, either as a string, or the result of a call to a position adjustment function.

  • $na_rm

    If false, the default, missing values are removed with a warning. If true, missing values are silently removed.

  • $show_legend

    Should this layer be included in the legends? undef, the default, includes if any aesthetics are mapped. A true scalar for never includes, and a defined false scalar for always includes.

  • $inherit_aes

    If false, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification.

  • %rest

    Other arguments passed to Chart::GGPlot::Layer->new(). These are often aesthetics, used to set an aesthetic to a fixed value, like color => "red", size => 3. They may also be parameters to the paired geom/stat.

  • $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 $bins bins that cover the range of the data.

  • $bins

    Number of bins. Overridden by $binwidth. Defaults to 30.

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

stat_boxplot

stat_boxplot(:$mapping=undef, :$data=undef,
             :$geom='boxplot', :$position='dodge2',
             :$coef=1.5,
             :$na_rm=false, :$show_legend='auto', :$inherit_aes=true,
             %rest)

Arguments:

  • $mapping

    Set of aesthetic mappings created by aes(). If specified and $inherit_aes is true (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

  • $data

    The data to be displayed in this layer. If undef, the default, the data is inherited from the plot data as specified in the call to ggplot().

  • $stat

    The statistical transformation to use on the data for this layer, as a string.

  • $position

    Position adjustment, either as a string, or the result of a call to a position adjustment function.

  • $na_rm

    If false, the default, missing values are removed with a warning. If true, missing values are silently removed.

  • $show_legend

    Should this layer be included in the legends? undef, the default, includes if any aesthetics are mapped. A true scalar for never includes, and a defined false scalar for always includes.

  • $inherit_aes

    If false, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification.

  • %rest

    Other arguments passed to Chart::GGPlot::Layer->new(). These are often aesthetics, used to set an aesthetic to a fixed value, like color => "red", size => 3. They may also be parameters to the paired geom/stat.

  • $coef

    Length of the whiskers as multiple of IQR. Defaults to 1.5.

stat_count

stat_count(:$mapping=undef, :$data=undef,
           :$geom='bar', :$position='stack', 
           :$width=undef,
           :$na_rm=false, :$show_legend=undef, :$inherit_aes=true,
           %rest)

Arguments:

  • $mapping

    Set of aesthetic mappings created by aes(). If specified and $inherit_aes is true (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

  • $data

    The data to be displayed in this layer. If undef, the default, the data is inherited from the plot data as specified in the call to ggplot().

  • $stat

    The statistical transformation to use on the data for this layer, as a string.

  • $position

    Position adjustment, either as a string, or the result of a call to a position adjustment function.

  • $na_rm

    If false, the default, missing values are removed with a warning. If true, missing values are silently removed.

  • $show_legend

    Should this layer be included in the legends? undef, the default, includes if any aesthetics are mapped. A true scalar for never includes, and a defined false scalar for always includes.

  • $inherit_aes

    If false, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification.

  • %rest

    Other arguments passed to Chart::GGPlot::Layer->new(). These are often aesthetics, used to set an aesthetic to a fixed value, like color => "red", size => 3. They may also be parameters to the paired geom/stat.

  • $width

    Bar width. By default, set to 90% of the resolution of the data.

stat_identity

stat_identity(:$mapping=undef, :$data=undef,
              :$geom="point", :$position="identity",
              :$show_legend=undef, :$inherit_aes=true,
              %rest)

Arguments:

  • $mapping

    Set of aesthetic mappings created by aes(). If specified and $inherit_aes is true (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

  • $data

    The data to be displayed in this layer. If undef, the default, the data is inherited from the plot data as specified in the call to ggplot().

  • $stat

    The statistical transformation to use on the data for this layer, as a string.

  • $position

    Position adjustment, either as a string, or the result of a call to a position adjustment function.

  • $na_rm

    If false, the default, missing values are removed with a warning. If true, missing values are silently removed.

  • $show_legend

    Should this layer be included in the legends? undef, the default, includes if any aesthetics are mapped. A true scalar for never includes, and a defined false scalar for always includes.

  • $inherit_aes

    If false, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification.

  • %rest

    Other arguments passed to Chart::GGPlot::Layer->new(). These are often aesthetics, used to set an aesthetic to a fixed value, like color => "red", size => 3. They may also be parameters to the paired geom/stat.

stat_smooth

stat_smooth(:$maping=undef, :$data=undef,
            :$geom='smooth', :$position='identity',
            :$method='auto', :$se=true,
            :$n=80, :$span=0.75, :$fullrange=false, :$level=0.95,
            :$method_args={},
            :$na_rm=false, :$show_legend='auto', :$inherit_aes=true,
            %rest)

Arguments:

  • $mapping

    Set of aesthetic mappings created by aes(). If specified and $inherit_aes is true (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

  • $data

    The data to be displayed in this layer. If undef, the default, the data is inherited from the plot data as specified in the call to ggplot().

  • $stat

    The statistical transformation to use on the data for this layer, as a string.

  • $position

    Position adjustment, either as a string, or the result of a call to a position adjustment function.

  • $na_rm

    If false, the default, missing values are removed with a warning. If true, missing values are silently removed.

  • $show_legend

    Should this layer be included in the legends? undef, the default, includes if any aesthetics are mapped. A true scalar for never includes, and a defined false scalar for always includes.

  • $inherit_aes

    If false, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification.

  • %rest

    Other arguments passed to Chart::GGPlot::Layer->new(). These are often aesthetics, used to set an aesthetic to a fixed value, like color => "red", size => 3. They may also be parameters to the paired geom/stat.

  • method

    Smoothing method (function) to use.

    The available methods are,

    • 'auto'

      'loess' is used for less than 1000 observations, 'glm' otherwise

    • 'loess'

      Locally Weighted Regression

      Requires Math::LOESS.

      Supported $method_args, (see Math::LOESS::Model for details)

      • $degree

      • $parametric

      • $drop_square

      • $normalize

      • $family

    • 'glm' : Generalized Linear Model

      Requires PDL::Stats::GLM and PDL::GSL::CDF.

      At this moment we can do only simple linear modeling. Still to support logistic and polynomial in future.

      Supported $method_args,

      • $family

  • method_args

    Additional optional arguments passed on to the modeling function defined by $method.

  • se

    Display confidence interval around smooth? (true by default, see $level to control.)

  • fullrange

    Should the fit span the full range of the plot, or just the data?

  • level

    Level of confidence interval to use (0.95 by default). Effective when $se is true.

  • span

    Controls the amount of smoothing for the default loess smoother. Larger number means more smoothing. It should be in the (0, 1) range.

  • n

    Number of points at which to evaluate smoother.

SEE ALSO

Chart::GGPlot::Stat

AUTHOR

Stephan Loyd <sloyd@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019-2023 by Stephan Loyd.

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