NAME
Chart::GGPlot::Geom::Functions - Function interface for Chart::GGPlot::Geom
VERSION
version 0.0010_01
DESCRIPTION
This module provides the geom_*
functions supported by this Chart-GGPlot library. When used standalone, each geom_*
function generates a Chart::GGPlot::Layer object. Also the functions can be used as Chart::GGPlot::Plot methods, to add layers into the plot object.
FUNCTIONS
geom_blank
geom_bar
geom_bar(:$mapping=undef, :$data=undef, :$stat='count',
:$position='stack', :$width=undef,
:$na_rm=false, :$show_legend=undef, :$inherit_aes=true,
%rest)
The "bar" geom makes the height bar proportional to the number of cases in each group (or if the weight
aesthetic is supplied, the sum of the weights
). It uses stat_count()
by default: it counts the number of cases at each x position.
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 toggplot()
.$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, likecolor => "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.
See also "stat_count" in Chart::GGPlot::Stat::Functions.
geom_histogram
geom_histogram(:$mapping=undef, :$data=undef, :$stat="bin",
:$position="stack", :$binwidth=undef, :$bins=undef,
:$na_rm=false, :$show_legend=undef, :$inherit_aes=true,
%rest)
Visualise the distribution of a single continuous variable by dividing the x axis into bins and counting the number of observations in each bin. This "histogram" geom displays the counts with bars.
$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 toggplot()
.$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, likecolor => "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.
See also "stat_bin" in Chart::GGPlot::Stat::Functions.
geom_col
geom_col(:$mapping=undef, :$data=undef, :$position="stack",
:$width=undef, :$na_rm=false, :$show_legend=undef,
:$inherit_aes=true,
%rest)
Bar plot. Different from geom_bar(), geom_col() uses stat_identity(): it leaves the data as is.
$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 toggplot()
.$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, likecolor => "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.
geom_boxplot
geom_boxplot(:$mapping=undef, :$data=undef,
:$stat='boxplot', :$position='dodge2',
:$outlier_color=undef, :$outlier_colour=undef,
:$outlier_fill=undef, :$outlier_shape=undef,
:$outlier_size=1.5, :$outlier_stroke=undef,
:$outlier_alpha=undef,
:$notch=false, :$notchwidth=0.25,
:$varwidth=false, :$na_rm=false,
:$show_legend=undef, :$inherit_aes=true,
%rest)
The boxplot compactly displays the distribution of a continuous variable. It visualises five summary statistics (the median, two hinges and two whiskers), and all "outlying" points individually.
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 toggplot()
.$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, likecolor => "red", size => 3
. They may also be parameters to the paired geom/stat.$outlier_color, $outlier_fill, $outlier_size, $outlier_stroke, $outlier_alpha
Default aesthetics for outliers. Set to
undef
to inherit from the aesthetics used for the box.Sometimes it can be useful to hide the outliers, for example when overlaying the raw data points on top of the boxplot. Hiding the outliers can be achieved by setting
outlier_shape => ''
. Importantly, this does not remove the outliers, it only hides them, so the range calculated for the y-axis will be the same with outliers shown and outliers hidden.$notch
If false (default) make a standard box plot. If true, make a notched box plot. Notches are used to compare groups; if the notches of two boxes do not overlap, this suggests that the medians are significantly different.
$notchwidth
For a notched box plot, width of the notch relative to the body.
See also "stat_boxplot" in Chart::GGPlot::Stat::Functions.
geom_path
geom_path(:$mapping=undef, :$data=undef, :$stat='identity',
:$position='identity', :$na_rm=false, :$show_legend=undef,
:$inherit_aes=true,
%rest)
The "path" geom connects the observations in the order in which they appear in the data.
$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 toggplot()
.$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, likecolor => "red", size => 3
. They may also be parameters to the paired geom/stat.
geom_point
geom_point(:$mapping=undef, :$data=undef, :$stat='identity',
:$position='identity',
:$na_rm=false, :$show_legend=undef, :$inherit_aes=true,
%rest)
The "point" geom is used to create scatterplots. The scatterplot is most useful for displaying the relationship between two continuous variables. A bubblechart is a scatterplot with a third variable mapped to the size of points.
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 toggplot()
.$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, likecolor => "red", size => 3
. They may also be parameters to the paired geom/stat.
geom_line
geom_line(:$mapping=undef, :$data=undef, :$stat='identity',
:$position='identity', :$na_rm=false, :$show_legend=undef,
:$inherit_aes=true,
%rest)
The "line" geom connects the observations in the order of the variable on the x axis.
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 toggplot()
.$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, likecolor => "red", size => 3
. They may also be parameters to the paired geom/stat.
geom_polygon
geom_polygon(:$mapping=undef, :$data=undef,
:$stat='identity', :$position='identity',
:$na_rm=false, :$show_legend=undef,
:$inherit_aes=true,
%rest)
Polygons are very similar to paths (as drawn by geom_path()
) except that the start and end points are connected and the inside is colored by the fill
aesthetic. The group
aesthetic determines which cases are connected together into a polygon.
$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 toggplot()
.$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, likecolor => "red", size => 3
. They may also be parameters to the paired geom/stat.
geom_rect
geom_rect(:$mapping=undef, :$data=undef, :$stat='count',
:$position='stack', :$width=undef,
:$na_rm=false, :$show_legend=undef, :$inherit_aes=true,
%rest)
geom_rect()
uses the locations of the four corners (aethetics xmin
, xmax
, ymin
and ymax
) to define rectangles.
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 toggplot()
.$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, likecolor => "red", size => 3
. They may also be parameters to the paired geom/stat.
geom_tile
geom_tile(:$mapping=undef, :$data=undef, :$stat='count',
:$position='stack', :$width=undef,
:$na_rm=false, :$show_legend=undef, :$inherit_aes=true,
%rest)
geom_tile()
uses the center of the tile and its size (aesthetics x
, y
, width
and height
) to define rectangles.
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 toggplot()
.$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, likecolor => "red", size => 3
. They may also be parameters to the paired geom/stat.
geom_raster
geom_raster(:$mapping=undef, :$data=undef, :$stat='count',
Num :$hjust=0.5, Num :$vjust=0.5,
:$position='stack', :$width=undef,
:$na_rm=false, :$show_legend=undef, :$inherit_aes=true,
%rest)
geom_raster()
is a high performance special case of geom_tile()
for when all the tiles are the same size.
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 toggplot()
.$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, likecolor => "red", size => 3
. They may also be parameters to the paired geom/stat.
geom_smooth
geom_smooth(:$mapping=undef, :$data=undef,
:$stat='smooth', :$position='identity',
:$method='auto', :$se=true,
:$na_rm=false, :$show_legend=undef, :$inherit_aes=true,
%rest)
Aids the eye in seeing patterns in the presence of overplotting, by calculating a smoothed conditional mean.
geom_smooth()
and stat_smooth()
are effectively aliases: they both use the same arguments. Use stat_smooth()
if you want to display the results with a non-standard geom.
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 toggplot()
.$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, likecolor => "red", size => 3
. They may also be parameters to the paired geom/stat.
See also "stat_smooth" in Chart::GGPlot::Stat::Functions.
SEE ALSO
Chart::GGPlot::Layer, Chart::GGPlot::Plot
AUTHOR
Stephan Loyd <sloyd@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2019 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.