Chart/GGPlot.pm

filter: Statementstmt 49.4% 48 / 97 Branchbran 0.0% 0 / 40 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 81.2% 13 / 16 Podpod 100% 2 / 2 totaltotal 38.6% 63 / 163 CC 24 SCAR 57.9
CC
24
Cov
34%
qplot
552.0
__ANON__
6.0
__ANON__
2.0
CRAP 326.2
« Chart/GGPlot/Backend/Plotly.pm ↑ Summary Chart/GGPlot/Util/Stats.pm »
1 package Chart::GGPlot;
2  
3 # ABSTRACT: ggplot2 port in Perl
4  
5 2 ▶use Chart::GGPlot::Setup qw(:base :pdl);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $VERSION = '0.002003'; # VERSION
8  
9 2 ▶use Data::Munge qw(elem);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Data::Frame::Types qw(DataFrame);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Data::Frame::Util qw(guess_and_convert_to_pdl);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Module::Load;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Types::PDL qw(Piddle1D PiddleFromAny);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use Types::Standard qw(Maybe Str);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 2 ▶use Chart::GGPlot::Plot;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 ▶use Chart::GGPlot::Aes;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶use Chart::GGPlot::Util qw(factor);
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 2 ▶use parent qw(Exporter::Tiny);
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 2 our @EXPORT_OK = qw(ggplot qplot);
23  
24 # PodWeaver would move the HTML/markdown block to after FUNCTION.
25 # So we have to move our DESCRIPTION part to the top and explicitly have
26 # a "=head1 FUNCTIONS" header, and not use =func directive.
27  
28  
29 2 for my $package (
30 qw(
31 Chart::GGPlot::Aes::Functions
32 Chart::GGPlot::Position::Functions
33 )
34 )
35 {
36 4 load $package, ':ggplot';
37 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
38 4 push @EXPORT_OK, @{ ${"${package}::EXPORT_TAGS"}{ggplot} };
39 }
40 2 push @EXPORT_OK, qw(factor);
41  
42 2 our %EXPORT_TAGS = ( all => \@EXPORT_OK );
43  
44  
45 6 ▶sub ggplot {
Subroutine ggplot: called CC=1 SCAR=0.0
Pod documented
46 6 return Chart::GGPlot::Plot->new(@_);
47 }
48  
49  
50 # Do not check :$x, :$y's types here as we would like to allow coercion
51 # from arrayref to piddle.
52 0 ▶fun qplot (
Subroutine qplot: not called CC=23 SCAR=63.1
Pod documented
53 :$x, :$y,
54 :$facets = undef,
55 Str :$geom = "auto",
56 :$xlim = undef, :$ylim = undef,
57 :$title = undef, :$xlab = 'x', :$ylab = 'y',
58 %rest
59 0 ▶ ) {
Branch: 8 branches
BranchTrueFalseTotal
@_ < 4 and Function::Parameters::_croak('Too few arguments for fun qplot (expected 4, got ' . @_ . ')') 0 0 0
@_ > 0 and @_ % 2 and Function::Parameters::_croak("Odd number of paired arguments for fun qplot") 0 0 0
exists $rest{'x'} ? : 0 0 0
exists $rest{'y'} ? : 0 0 0
exists $rest{'geom'} ? : 0 0 0
exists $rest{'xlab'} ? : 0 0 0
exists $rest{'ylab'} ? : 0 0 0
Type::Tiny::XS::Str($geom) or Function::Parameters::_croak('In fun qplot: parameter 4 ($geom): ' . ${my $v = bless( {"_default_message" => sub { package Type::Tiny; use warnings; use strict; sprintf '%s did not pass type constraint "%s"', _dd($_[0]), $name;},"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; Type::Tiny::XS::Str($_[0]) or _failed_check(9, 'Str', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Str","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref \$_ eq 'SCALAR' or ref \(my $val = $_) eq 'SCALAR';},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 291,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Str","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; use warnings; use strict; $Type::Tiny::AvoidCallbacks ? goto $orig_inlined : "$xsubname($_[1])";},"is_using_default_message" => 1,"library" => "Types::Standard","moose_type" => bless( {"Types::TypeTiny::to_TypeTiny" => {},"_default_message" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; my $value = shift(); my $can_partialdump = &try(sub { require Devel::PartialDump; 'Devel::PartialDump'->VERSION(0.14); 1; } ); if ($can_partialdump) { $value = 'Devel::PartialDump'->new->dump($value); } else { $value = defined $value ? overload::StrVal($value) : 'undef'; } return q[Validation failed for '] . $name . "' with value $value";},"compiled_type_constraint" => sub { package Eval::Closure::Sandbox_51; use warnings; use strict; do { do { do { defined $_[0] } and not ref $_[0] } and ref \$_[0] eq 'SCALAR' || ref \(my $val = $_[0]) eq 'SCALAR' };},"constraint" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; ref \$_ eq 'SCALAR' or ref \(my $val = $_) eq 'SCALAR';},"inline_environment" => {},"inlined" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; $_[0]->parent->_inline_check($_[1]) . ' && (' . 'ref(\\' . $_[1] . ') eq "SCALAR"' . ' || ref(\\(my $val = ' . $_[1] . ')) eq "SCALAR"' . ')';},"name" => "Str","package_defined_in" => "Moose::Util::TypeConstraints::Builtins","parent" => bless( {"_default_message" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; my $value = shift(); my $can_partialdump = &try(sub { require Devel::PartialDump; 'Devel::PartialDump'->VERSION(0.14); 1; } ); if ($can_partialdump) { $value = 'Devel::PartialDump'->new->dump($value); } else { $value = defined $value ? overload::StrVal($value) : 'undef'; } return q[Validation failed for '] . $name . "' with value $value";},"compiled_type_constraint" => sub { package Eval::Closure::Sandbox_49; use warnings; use strict; do { do { defined $_[0] } and not ref $_[0] };},"constraint" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; not ref $_;},"inline_environment" => {},"inlined" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; $_[0]->parent->_inline_check($_[1]) . ' && !ref(' . $_[1] . ')';},"name" => "Value","package_defined_in" => "Moose::Util::TypeConstraints::Builtins","parent" => bless( {"Types::TypeTiny::to_TypeTiny" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; defined $_[0] or _failed_check(7, 'Defined', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Defined","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; defined $_[0] and _failed_check(6, 'Undef', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Undef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => {},"constraint" => sub { package Types::Standard; no warnings; use strict; not defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 254,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Undef","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "!defined($_[1])";},"library" => "Types::Standard","name" => "Undef","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","moose_type" => bless( {"Types::TypeTiny::to_TypeTiny" => {},"_default_message" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; my $value = shift(); my $can_partialdump = &try(sub { require Devel::PartialDump; 'Devel::PartialDump'->VERSION(0.14); 1; } ); if ($can_partialdump) { $value = 'Devel::PartialDump'->new->dump($value); } else { $value = defined $value ? overload::StrVal($value) : 'undef'; } return q[Validation failed for '] . $name . "' with value $value";},"compiled_type_constraint" => sub { package Eval::Closure::Sandbox_44; use warnings; use strict; do { 1 };},"constraint" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; 1;},"inline_environment" => {},"inlined" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; '1';},"name" => "Any","package_defined_in" => "Moose::Util::TypeConstraints::Builtins"}, 'Moose::Meta::TypeConstraint' ),"name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 6}, 'Type::Tiny' ),"constraint" => sub { package Types::Standard; no warnings; use strict; defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 262,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Defined","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1])";},"library" => "Types::Standard","moose_type" => {},"name" => "Defined","parent" => {},"uniq" => 7}, 'Type::Tiny' ),"_default_message" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; my $value = shift(); my $can_partialdump = &try(sub { require Devel::PartialDump; 'Devel::PartialDump'->VERSION(0.14); 1; } ); if ($can_partialdump) { $value = 'Devel::PartialDump'->new->dump($value); } else { $value = defined $value ? overload::StrVal($value) : 'undef'; } return q[Validation failed for '] . $name . "' with value $value";},"compiled_type_constraint" => sub { package Eval::Closure::Sandbox_47; use warnings; use strict; do { defined $_[0] };},"constraint" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; defined $_;},"inline_environment" => {},"inlined" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; 'defined(' . $_[1] . ')';},"name" => "Defined","package_defined_in" => "Moose::Util::TypeConstraints::Builtins","parent" => bless( {"_default_message" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; my $value = shift(); my $can_partialdump = &try(sub { require Devel::PartialDump; 'Devel::PartialDump'->VERSION(0.14); 1; } ); if ($can_partialdump) { $value = 'Devel::PartialDump'->new->dump($value); } else { $value = defined $value ? overload::StrVal($value) : 'undef'; } return q[Validation failed for '] . $name . "' with value $value";},"compiled_type_constraint" => sub { package Eval::Closure::Sandbox_45; use warnings; use strict; do { 1 };},"constraint" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; 1;},"inline_environment" => {},"inlined" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; '1';},"name" => "Item","package_defined_in" => "Moose::Util::TypeConstraints::Builtins","parent" => {}}, 'Moose::Meta::TypeConstraint' )}, 'Moose::Meta::TypeConstraint' )}, 'Moose::Meta::TypeConstraint' )}, 'Moose::Meta::TypeConstraint' ),"name" => "Str","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; defined $_[0] and not ref $_[0] or _failed_check(8, 'Value', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Value","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; not ref $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 276,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Value","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1]) and not ref($_[1])";},"library" => "Types::Standard","name" => "Value","parent" => {},"uniq" => 8}, 'Type::Tiny' ),"sorter" => sub { package Types::Standard; no warnings; use strict; $_[0] cmp $_[1];},"type_default" => sub { package Types::Standard; no warnings; use strict; return '';},"uniq" => 9}, 'Type::Tiny' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"moose_type"}{"Types::TypeTiny::to_TypeTiny"} = $v;$v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"coercion"}{"type_constraint"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"};$v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"compiled_type_constraint"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"coercion"}{"type_constraint"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"};$v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"compiled_type_constraint"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"complementary_type"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"};$v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"};$v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"}{"compiled_type_constraint"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"}{"parent"};$v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"}{"parent"}{"constraint"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"}{"constraint"};$v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"}{"parent"}{"moose_type"}{"Types::TypeTiny::to_TypeTiny"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"}{"parent"};$v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"moose_type"} = $v->{"moose_type"}{"parent"}{"parent"};$v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"parent"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"};$v->{"moose_type"}{"parent"}{"parent"}{"parent"}{"parent"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}{"complementary_type"}{"parent"}{"parent"}{"moose_type"};$v->{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"};$v->{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"} = $v->{"moose_type"}{"parent"}{"parent"}{"Types::TypeTiny::to_TypeTiny"}; \$v}->get_message($geom)) 0 0 0
Condition0%0/3
@_ > 0 and @_ % 2
!ll&&!rl&&r
000
MC/DC0%0/2
@_ > 0 and @_ % 2
@_ > 0 @_ % 2
Truth table0%0/3
A and B
A= @_ > 0B= @_ % 2
ABresult
0X0
100
111
60 # Can't do :$log in func params as it would conflict with $log
61 # from Log::Any.
62 0 ▶ my $log_mode = $rest{log} // '';
Condition0%0/2
$rest{"log"} // ""
l!l
00
MC/DC0%0/1
$rest{"log"} // ""
$rest{"log"}
Truth table0%0/2
A
A= $rest{"log"}
Aresult
11
00
63 0 state $supported_log_modes = ['', 'x', 'y', 'xy'];
64 0 ▶ unless ( elem( $log_mode, $supported_log_modes ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (elem($log_mode, $supported_log_modes)) 0 0 0
65 die "'log' shall be one of "
66 0 . join( ', ', map { qq("$_") } @$supported_log_modes );
67 }
68  
69 0 my $all_aesthetics = Chart::GGPlot::Aes->all_aesthetics;
70  
71 0 $x = guess_and_convert_to_pdl($x);
72 0 $y = guess_and_convert_to_pdl($y);
73  
74 0 ▶ unless ( $x->length == $y->length ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($x->length == $y->length) 0 0 0
75 0 die "x and y must have same length";
76 }
77  
78 0 my $mapping = aes( x => 'x', y => 'y' );
79 0 for my $aes ( grep { elem( $_, $all_aesthetics ) } keys %rest ) {
80 0 $mapping->set( $aes, $aes );
81 }
82  
83 0 $log->debug('qplot() $mapping = ' . Dumper($mapping));
84  
85 my $data = Data::Frame->new(
86 columns => [
87 x => guess_and_convert_to_pdl($x),
88 y => guess_and_convert_to_pdl($y),
89  
90 0 ▶ $mapping->keys->grep( sub { $_ ne 'x' and $_ ne 'y' } )->map(
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_ ne "x" and $_ ne "y" 0 0 0
91 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
92 0 my $d = guess_and_convert_to_pdl( $rest{$_} );
93 0 $_ => $d->repeat_to_length( $x->length );
94 }
95 0 )->flatten
96 ]
97 );
98  
99 0 my $p = ggplot( data => $data, mapping => $mapping );
100  
101 0 ▶ if ( not defined $facets ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $facets) { } 0 0 0
102 0 $p->facet_null();
103 }
104 else {
105 0 die "'facets' is not yet supported.";
106 }
107  
108 0 ▶ my $geom_func = $geom eq 'auto' ? 'geom_point' : "geom_${geom}";
Branch: 1 branch
BranchTrueFalseTotal
$geom eq 'auto' ? : 0 0 0
109 0 $p->$geom_func();
110  
111 0 ▶ if ( $log_mode =~ /x/ ) { $p->scale_x_log10(); }
Branch: 1 branch
BranchTrueFalseTotal
if ($log_mode =~ /x/u) 0 0 0
112 0 ▶ if ( $log_mode =~ /y/ ) { $p->scale_y_log10(); }
Branch: 1 branch
BranchTrueFalseTotal
if ($log_mode =~ /y/u) 0 0 0
113  
114 0 ▶ $p->ggtitle($title) if ( defined $title );
Branch: 1 branch
BranchTrueFalseTotal
if defined $title 0 0 0
115 0 ▶ $p->xlab($xlab) if ( defined $xlab );
Branch: 1 branch
BranchTrueFalseTotal
if defined $xlab 0 0 0
116 0 ▶ $p->ylab($ylab) if ( defined $ylab );
Branch: 1 branch
BranchTrueFalseTotal
if defined $ylab 0 0 0
117 0 ▶ $p->xlim($xlim) if ( defined $xlim );
Branch: 1 branch
BranchTrueFalseTotal
if defined $xlim 0 0 0
118 0 ▶ $p->ylim($ylim) if ( defined $ylim );
Branch: 1 branch
BranchTrueFalseTotal
if defined $ylim 0 0 0
119  
120 0 return $p;
121 2 }
122  
123 2 1;
124  
125 __END__
« Chart/GGPlot/Backend/Plotly.pm ↑ Summary Chart/GGPlot/Util/Stats.pm »