NAME
Chart::GGPlot::Limits - Functions for applying limits to the scales
VERSION
version 0.0000_01
SYNOPSIS
use Chart::GGPlot qw(:all);
my $plot1 = ggplot(data => $mtcars,
mapping => aes(x => 'mpg', y => 'wt')) +
geom_point() + xlim(15, 20);
# if the larger value comes first, the scale will be reversed
my $plot2 = ggplot(data => $mtcars,
mapping => aes('mpg', 'wt')) +
geom_point() + xlim(20, 15);
# you can leave one value as NA to compute from the range of the data
my $plot3 = ggplot(data => $mtcars,
mapping => aes('mpg', 'wt')) +
geom_point() + xlim(NA, 20);
DESCRIPTION
By default, any values outside limits will be treated as NA
and are thus not plotted.
FUNCTIONS
lims(%pairs)
Call limits()
on each kv pair in %pairs
. Returns an array ref like [ limits($key1, $value1), ... ]
.
xlim($a, $b)
This is a shortcut of
limits(x => [$a, $b]);
ylim($a, $b)
This is a shortcut of
limits(y => [$a, $b]);
limits($var, $v)
expand_limits(%params)
Expand the plot limits, using data.
my $p = ggplot($mtcars, aes( x=> 'mpg', y => 'wt')) + geom_point();
$p += expand_limits(x => 0);
$p += expand_limits(y => [1, 9]);
AUTHOR
Stephan Loyd <sloyd@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2018 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.