NAME
Chart::GGPlot::Plot - ggplot class
VERSION
version 0.002003
DESCRIPTION
This class represents the ggplot plot class. Instead of this class you would usually want to directly use Chart::GGPlot, which is a function interface of this library and is closer to R ggplot2's API.
ATTRIBUTES
backend
Consumer of Chart::GGPlot::Backend. Default is a Chart::GGPlot::Backend::Plotly object.
data
Data::Frame object.
mapping
Aesthetics mapping. Default is an empty Chart::GGPlot::Aes object.
METHODS
show
show(HashRef $opts={})
Show the plot (like in web browser). Implementation depends on the plotting backend.
save
save($filename, HashRef $opts={})
Export the plot to a static image file. Implementation depends on the plotting backend.
iplot
iplot(HashRef $opts={})
Generate plot for IPerl in Jupyter notebook. Implementation depends on the plotting backend.
summary
summary()
Get a useful description of a ggplot object.
theme
theme()
Returns theme of the plot.
add_layer
add_layer($layer)
Adds a Chart::GGPlot::Layer object to the plot.
You normally don't have to explicitly call this method.
add_labels
add_labels($labels)
Adds a Chart::GGPlot::Label object to the plot.
You normally don't have to explicitly call this method.
add_scale
add_scale($scale)
You normally don't have to explicitly call this method.
add_coord
add_coord($coord)
You normally don't have to explicitly call this method.
MORE METHODS
This class uses Perl's autoloading feature, to allow this class to get into its member methods exported functions of :ggplot
tag from several other namespaces:
For example, when you do
$plot->geom_point(...)
It internally does something like,
my $layer = Chart::GGPlot::Geom::Functions::geom_point(...);
$plot->add_layer($layer);
Depend on the return type of the function it would call one of the class's add/set methods. In this case of geom_point()
we get a layer object so add_layer()
is called.
SEE ALSO
Chart::GGPlot::Backend, Chart::GGPlot::Backend::Plotly
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.