Branch Coverage

blib/lib/Matplotlib/Simple.pm
Criterion Covered Total %
branch 364 650 56.0


line true false branch
285 0 69 if (ref $args ne "HASH")
294 0 69 if (scalar @undef_args > 0)
312 0 79 if (ref $args ne "HASH")
321 0 79 if (scalar @undef_args > 0)
330 0 79 if (scalar @bad_args > 0)
344 39 2 if ($args->{'args'}{$item} =~ /^([^\"\',]+)$/)
353 0 44 if ($ref ne "ARRAY" and $ref ne "")
356 43 1 if ($ref eq "")
357 0 43 if ($method eq 'show') { }
370 0 79 unless defined $args->{'ax'}
373 2 77 if (defined $args->{'args'}{'plot.type'} and $args->{'args'}{'plot.type'} eq "pie")
377 2 77 if $pie_plot == 1
388 0 7 if (ref $args ne "HASH")
397 0 7 if (scalar @undef_args > 0)
408 1 6 if (scalar @bad_opt > 0)
417 0 6 if (scalar keys %ref_counts > 1)
423 4 2 if (defined $ref_counts{''}) { }
0 2 elsif (defined $ref_counts{'ARRAY'}) { }
2 0 elsif (defined $ref_counts{'HASH'}) { }
448 0 2 if ($plot_type eq "grouped" and defined $plot->{'width'} and $plot->{'stacked'} == 0)
456 0 6 if (defined $plot->{'key.order'}) { }
462 0 6 if ($plot->{'log'} or $plot->{'logscale'})
466 0 1 if $c eq "color" and $plot_type eq "grouped" and ref $plot->{$c} ne ""
468 1 0 if ($ref eq '') { }
0 0 elsif ($ref eq 'ARRAY') { }
0 0 elsif ($ref eq 'HASH') { }
480 0 0 if ($ref eq '') { }
0 0 elsif ($ref eq 'ARRAY') { }
491 0 0 if ($ref eq '') { }
0 0 elsif ($ref eq 'HASH') { }
496 0 0 if (scalar @{$plot->{$err}{$i};} != 2)
512 4 2 if ($plot_type eq 'simple') { }
2 0 elsif ($plot_type eq 'grouped') { }
519 0 4 if (defined $plot->{'color'} and ref $plot->{'color'} eq "HASH")
521 0 0 if (scalar @undef_args > 0)
538 1 1 if ($plot->{'stacked'} == 0)
544 1 1 if $plot->{'plot.type'} eq "bar"
554 4 4 if ref $plot->{$_} eq "ARRAY"
558 2 2 if ($plot->{'stacked'} > 0)
559 2 0 $plot->{'plot.type'} eq 'barh' ? :
567 2 2 if $plot->{'stacked'} > 0
569 2 2 if $plot->{'stacked'} <= 0
574 1 1 if $plot->{'plot.type'} eq "bar"
589 0 4 if (ref $args ne "HASH")
597 0 4 if (scalar @undef_args > 0)
609 0 4 if (scalar @bad_opt > 0)
614 0 4 unless ($plot->{'orientation'} =~ /^(?:horizontal|vertical)$/)
618 1 3 if (ref $plot->{'data'} eq "ARRAY")
623 0 4 if (defined $plot->{'key.order'}) { }
639 0 0 if ($axis =~ /^([^xy])$/)
649 0 5 if (scalar @non_numeric > 0)
656 0 4 if (defined $plot->{'colors'}) { }
660 0 0 if (scalar @bad_keys > 0)
675 0 4 if (defined $plot->{'color'})
684 4 0 if ($plot->{'orientation'} eq 'vertical') { }
698 0 3 if (ref $args ne "HASH")
706 0 3 if (scalar @undef_args > 0)
714 0 3 if (scalar @bad_args > 0)
725 1 2 if (defined $plot->{'col.labels'}) { }
733 9 18 if $plot->{'mirror'} > 0
736 1 2 if (defined $plot->{'row.labels'}) { }
759 0 3 if $plot->{'cb_logscale'} > 0
769 0 0 unless (&looks_like_number($plot->{$opt}))
775 0 3 if (scalar @options > 0)
778 0 3 if ($plot->{'cb_logscale'}) { }
784 1 2 if (defined $plot->{'cblabel'}) { }
787 2 0 if $plot->{'colorbar.on'}
795 1 2 if ($plot->{'show.numbers'}) { }
804 0 0 if ($axis =~ /^([^xy])$/)
822 0 3 if (ref $args ne "HASH")
830 0 3 if (scalar @undef_args > 0)
843 0 3 if (scalar @undef_args > 0)
853 0 3 if ($plot->{'xbins'} == 0 or $plot->{'ybins'} == 0)
858 1 2 if (defined $plot->{'key.order'}) { }
863 0 3 if (scalar @keys != 2)
868 0 3 if (scalar @{$plot->{'data'}{$keys[1]};} != $n_points)
881 0 3 if ($plot->{'cb_logscale'})
892 0 0 if ($plot->{$opt} ne "log" and $plot->{$opt} ne "linear")
899 0 3 if (defined $plot->{'marginals'} and $plot->{'marginals'} > 0)
915 0 0 unless &looks_like_number($plot->{$o})
921 0 3 if ($plot->{'colorbar.on'} and defined $plot->{'shared.colorbar'})
925 0 3 if (defined $plot->{'cblabel'}) { }
941 0 10 unless defined $format
951 0 25 if (ref $args ne "HASH")
961 0 25 if (scalar @undef > 0)
971 0 25 if (scalar @undef > 0)
978 0 1 if ref $plot->{$arg} eq "HASH"
980 0 1 if ($ref eq '') { }
1 0 elsif ($ref eq 'ARRAY') { }
981 0 0 if ($plot->{$arg} =~ /^[A-Za-z]+$/) { }
994 0 0 if ($axis =~ /^([^xy])$/)
1000 1 24 if (ref $plot->{'data'} eq "ARRAY")
1004 1 24 if (scalar keys %{$$plot{'data'};} > 1) { }
1011 0 26 if (scalar @non_numeric > 0)
1019 0 0 unless defined $plot->{$arg}{$set}
1020 0 0 if ($plot->{$arg}{$set} =~ /^[A-Za-z]+$/) { }
1027 2 24 if ($plot->{'show.legend'}) { }
1039 0 7 if (ref $args ne "HASH")
1047 0 7 if (scalar @undef_args > 0)
1057 0 7 if (scalar @undef_args > 0)
1066 0 7 if ($plot->{'xbins'} == 0 or $plot->{'ybins'} == 0)
1071 0 7 if (defined $plot->{'key.order'}) { }
1076 0 7 if (scalar @keys != 2)
1081 0 7 if (scalar @{$plot->{'data'}{$keys[1]};} != $n_points)
1092 1 6 if ($plot->{'cb_logscale'})
1097 0 0 unless (&looks_like_number($plot->{$arg}))
1115 0 7 if ($bad_pts > 0)
1124 0 7 if ($bad_pts > 0)
1143 0 7 if ($plot->{'logscale'}) { }
1146 0 0 if ($axis =~ /^([^xy])$/)
1171 1 6 if $plot->{'show.colorbar'} == 0
1179 0 2 unless &looks_like_number($plot->{$o})
1185 1 5 if ($plot->{'colorbar.on'} and defined $plot->{'shared.colorbar'})
1190 1 5 if (defined $plot->{'cblabel'}) { }
1201 0 5 if (ref $args ne "HASH")
1211 0 5 if (scalar @undef_args > 0)
1221 0 5 if (scalar @undef_args > 0)
1227 1 4 if ($data_ref ne "ARRAY")
1233 1 6 if (grep {not &looks_like_number($_);} @{$row;})
1238 0 4 if ($non_numeric_data and not defined $plot->{'stringmap'})
1248 1 3 if ($non_numeric_data)
1255 1 3 if ($non_numeric_data)
1261 0 1 if defined $plot->{'cmap'}
1273 2 6 if $non_numeric_data
1288 1 3 if ($non_numeric_data)
1297 0 1 unless &looks_like_number($plot->{$o})
1303 0 4 if ($plot->{'colorbar.on'} and defined $plot->{'shared.colorbar'})
1307 4 0 if $plot->{'colorbar.on'}
1308 1 0 if ($non_numeric_data and $plot->{'colorbar.on'})
1317 0 2 if (ref $args ne "HASH")
1327 0 2 if (scalar @undef_args > 0)
1337 0 2 if (scalar @undef_opt > 0)
1343 0 2 if (defined $plot->{'key.order'}) { }
1350 0 2 if ($plot->{'autopct'} ne "")
1371 0 13 if (ref $args ne "HASH")
1379 0 13 if (scalar @undef_args > 0)
1389 0 13 if (scalar @bad_opt > 0)
1396 0 0 if ($axis =~ /^([^xy])$/)
1411 2 4 if (ref $plot->{'data'} eq "ARRAY" and scalar @{$plot->{'data'};} == 2 and ref $plot->{'data'}[0] eq "ARRAY" and ref $plot->{'data'}[1] eq "ARRAY" and ref $plot->{'data'}[0][0] ne "ARRAY")
1419 6 7 if (ref $plot->{'data'} eq "ARRAY")
1420 4 2 if (defined $plot->{'set.options'})
1424 2 2 if ($ref_type eq 'ARRAY') { }
0 2 elsif ($ref_type ne '') { }
1427 0 2 if ($n_set_opt > $n_data)
1436 0 6 if (defined $plot->{'twinx'})
1437 0 0 if (ref $plot->{'twinx'} eq '') { }
0 0 elsif (ref $plot->{'twinx'} eq 'ARRAY') { }
1438 0 0 unless $plot->{'twinx'} =~ /^\d+$/
1442 0 0 if (scalar @bad_opt > 0)
1449 1 5 if (defined $plot->{'twinx.args'})
1451 0 1 unless $ref eq "HASH"
1453 0 1 if (scalar @bad_opt > 0)
1458 0 1 if grep {$idx == $_;} @twinx
1465 0 10 if ($ref ne "ARRAY")
1470 0 10 if ($n_elem != 2)
1475 0 10 if ($bad_opt[0] != $bad_opt[1])
1483 20 0 if scalar @bad_opt == 0
1494 7 3 if (defined $plot->{'set.options'})
1496 3 4 if ($so_ref eq '') { }
4 0 elsif ($so_ref eq 'ARRAY' and defined $plot->{'set.options'}[$arr_i]) { }
1504 1 9 if (grep {$arr_i == $_;} @twinx) { }
1507 1 0 if (defined $plot->{'twinx.args'}{$arr_i})
1522 0 7 if (defined $plot->{'key.order'}) { }
1527 2 5 if (defined $plot->{'set.options'} and ref $plot->{'set.options'} eq "HASH")
1529 0 2 if (scalar @bad_opt > 0)
1534 0 7 if (defined $plot->{'twinx'})
1535 0 0 if (ref $plot->{'twinx'} eq '') { }
0 0 elsif (ref $plot->{'twinx'} eq 'HASH') { }
1536 0 0 unless defined $plot->{'data'}{$plot->{'twinx'}}
1540 0 0 if (scalar @bad_opt > 0)
1547 1 6 if (defined $plot->{'twinx.args'})
1549 0 1 unless $ref eq "HASH"
1551 0 1 if (scalar @bad_opt > 0)
1556 0 1 if grep {$set eq $_;} @twinx
1563 0 8 if ($set_ref ne "ARRAY")
1568 0 8 if ($n_arrays != 2)
1573 0 8 if ($n_elem[0] != $n_elem[1])
1581 0 16 if (scalar @undef_i > 0)
1591 0 8 if (defined $plot->{'set.options'} and ref $plot->{'set.options'} eq "")
1596 3 5 if (ref $plot->{'set.options'} eq "HASH" and defined $plot->{'set.options'}{$set})
1600 4 4 if ($plot->{'show.legend'})
1604 1 7 if (grep {$set eq $_;} @twinx) { }
1607 1 0 if (defined $plot->{'twinx.args'}{$set})
1626 0 6 if (ref $args ne "HASH")
1634 0 6 if (scalar @undef_args > 0)
1644 0 6 if (scalar @undef_args > 0)
1649 0 6 if ($overall_ref ne "HASH")
1658 0 6 if (scalar keys %ref_counts > 1)
1662 4 2 if (defined $ref_counts{'ARRAY'}) { }
2 0 elsif (defined $ref_counts{'HASH'}) { }
1675 4 2 if ($plot_type eq 'single') { }
2 0 elsif ($plot_type eq 'multiple') { }
1678 0 4 if (defined $plot->{'keys'}) { }
1684 0 4 if ($n_keys != 2 and $n_keys != 3)
1688 4 0 if (defined $plot->{'color_key'}) { }
0 0 elsif (scalar @keys == 3) { }
1696 0 8 if (scalar @undef_i > 0)
1703 0 4 if (defined $plot->{'set.options'} and ref $plot->{'set.options'} eq "")
1710 0 0 unless &looks_like_number($plot->{$o})
1715 4 0 if (defined $color_key) { }
1716 0 4 unless (defined $plot->{'data'}{$color_key})
1731 2 0 if grep {$set eq $_;} keys %{$$plot{"data"};}
1734 0 2 if (scalar @undefined_opts > 0)
1745 0 4 if (defined $plot->{'keys'}) { }
1751 0 4 if ($n_keys != 2 and $n_keys != 3)
1757 0 8 if (scalar @undef_args > 0)
1762 0 4 if (defined $plot->{'color_key'}) { }
0 4 elsif (scalar @keys == 3) { }
1768 0 4 if (not defined $color_key and $n_keys == 3)
1771 2 2 if (defined $plot->{'set.options'}{$set})
1776 0 4 if (defined $color_key) { }
1777 0 0 unless (defined $plot->{'data'}{$set}{$color_key})
1781 0 0 unless ($options =~ /label\s*=/)
1792 0 2 if defined $color_key
1800 0 4 if (ref $args ne "HASH")
1808 0 4 if (scalar @undef_args > 0)
1818 0 4 if (scalar @undef_opt > 0)
1823 0 4 unless ($plot->{'orientation'} =~ /^(?:horizontal|vertical)$/)
1826 2 2 if (ref $plot->{'data'} eq "ARRAY")
1831 0 4 if (defined $plot->{'key.order'}) { }
1844 63 0 if defined $_
1850 0 0 if ($axis =~ /^([^xy])$/)
1857 0 4 if (defined $plot->{'colors'}) { }
1860 0 0 if (scalar @wrong_keys > 0)
1875 0 4 if (defined $plot->{'color'})
1882 4 0 if ($plot->{'whiskers'})
1908 4 0 if ($plot->{'orientation'} eq 'vertical') { }
1923 5 0 if ($plot->{'orientation'} eq 'vertical') { }
1934 4 0 if ($plot->{'orientation'} eq 'vertical') { }
1949 0 3 if (ref $args ne "HASH")
1957 0 3 if (scalar @undef_args > 0)
1968 0 3 if (scalar @undef_opt > 0)
1976 1 2 if ($ref_type eq 'HASH') { }
2 0 elsif ($ref_type eq 'ARRAY') { }
2000 2 0 if ($plot->{'show.legend'} > 0) { }
2042 6 1 if (&looks_like_number($str))
2045 0 1 if ($str =~ /\w+\h*=\h*["'\(]/)
2048 1 0 if ($str =~ /^\w+$/) { }
0 0 elsif ($str =~ /^\[\h*\-?\d.+\d\h*\]$/) { }
0 0 elsif ($str =~ m"[!\@#\$\%^&*\(\)\{\}\[\]\<\>,/\-\h:;\+=\w]+$") { }
0 0 elsif ($str =~ /,/ and not $str =~ /[\]\[]/) { }
2078 1 16 if (ref $p ne "ARRAY")
2081 1 15 if (scalar @{$p;} == 0)
2092 16 5 if ($ref eq 'HASH') { }
4 1 elsif ($ref eq 'ARRAY') { }
2095 1 3 if (scalar @{$subplot;} == 0)
2101 1 4 if (ref $plot ne "HASH")
2106 2 0 if scalar @g
2121 4 4 if (not defined $ncols || defined $nrows) { }
1 3 elsif (not defined $ncols and $nrows > 0) { }
2 2 elsif (not defined $nrows and $ncols > 0) { }
2140 29 49 if (scalar @_ == 1 and ref $_[0] eq 'HASH') { }
49 0 elsif (scalar @_ % 2 == 0) { }
2148 17 61 if defined $args->{'p'}
2149 0 69 if (scalar grep({$args->{$_};} "output.file", "show") == 0)
2153 6 63 $args->{'show'} ? :
2187 0 69 if (scalar @undef_args > 0)
2191 0 10 unless (defined $args->{'plot.type'} or defined $args->{'plots'})
2197 0 69 if (ref $args->{'output.file'} ne "")
2206 0 69 if (scalar @bad_args > 0)
2212 0 69 if defined $args->{'nrow'}
2213 0 69 if defined $args->{'ncol'}
2217 58 11 if (defined $args->{'plot.type'} and defined $args->{'data'})
2220 0 69 if ($single_plot == 1 and not defined $args->{'plot.type'})
2225 1 68 if ($single_plot == 0 and not defined $args->{'plots'})
2229 0 68 if ($single_plot == 0 and ref $args->{'plots'} ne "ARRAY")
2233 0 68 if ($single_plot == 0 and scalar @{$args->{'plots'};} == 0)
2237 58 10 if ($single_plot == 1)
2238 116 0 if defined $args->{$_}
2243 0 68 if ($single_plot == 0 and $args->{'nrows'} * $args->{'ncols'} < scalar @{$args->{'plots'};})
2253 10 58 if ($single_plot == 0)
2257 0 10 if (scalar @bad_args > 0)
2265 0 10 if (scalar @output_file > 0)
2271 0 58 if ($single_plot == 1 and ref $args->{'data'} eq "HASH" and scalar keys %{$$args{"data"};} == 0)
2275 141 267 if defined $args->{$_}
2276 0 68 if (scalar @bad_args > 0)
2293 0 68 if (defined $args->{'shared.colorbar'} and $single_plot == 1)
2297 1 67 if (defined $args->{'shared.colorbar'})
2299 0 1 if ($ref ne "ARRAY")
2304 0 1 if ($max_subplot_idx > $args->{'nrows'} * $args->{'ncols'} - 1)
2309 1 67 if (defined $args->{'add'})
2311 0 1 if ($ref ne "ARRAY")
2315 0 68 if (defined $args->{'fh'}) { }
2317 0 0 if ($ref ne "File::Temp")
2331 68 0 unless (grep {/utf-?8/i;} &PerlIO::get_layers($fh))
2337 10 58 if ($single_plot == 0) { }
58 0 elsif ($single_plot == 1) { }
2348 10 58 if (defined $args->{'plots'})
2352 22 0 if defined $plot->{'plot.type'}
2356 0 10 if (scalar @undef_plot_types > 0)
2372 58 10 if ($single_plot == 1)
2376 0 1 unless defined $type
2377 0 1 unless defined $dispatch{$type}
2386 1 57 unless (defined $dispatch{$type})
2413 2 20 if (defined $args->{'shared.colorbar'} and grep {$_ == $ax;} @{$$args{"shared.colorbar"};})
2417 1 1 if ($ax == &max(@{$$args{'shared.colorbar'};})) { }
2425 2 20 if (defined $plot->{'add'})
2427 0 2 if ($ref ne "ARRAY")
2434 0 2 unless defined $type
2435 0 2 unless defined $dispatch{$type}
2447 0 22 if (scalar @undef_keys > 0)
2479 7 0 if ($ref eq '') { }
0 0 elsif ($ref eq 'ARRAY') { }
2481 6 1 if ($plt_method eq 'show') { }
1 0 elsif ($type eq 'single quotes') { }
0 0 elsif ($type eq 'no quotes') { }
2491 0 0 if ($type eq 'single quotes') { }
0 0 elsif ($type eq 'no quotes') { }
2505 0 0 if ($ref eq '') { }
0 0 elsif ($ref eq 'ARRAY') { }
2516 1 64 if (defined $args->{'scale'})
2520 1 64 if (defined $args->{'scalex'})
2523 1 64 if (defined $args->{'scaley'})
2526 59 6 if (defined $args->{'output.file'})
2536 6 59 if $args->{'show'}
2538 65 0 if $args->{'execute'} == 0
2539 0 65 if ($args->{'execute'}) { }
2543 0 0 if ($exit != 0)
2549 0 0 if defined $args->{'output.file'}
2552 59 6 if defined $args->{'output.file'}
2564 0 14 if (scalar @_ == 1 and ref $_[0] eq 'HASH') { }
14 0 elsif (scalar @_ % 2 == 0) { }
2572 0 14 if (defined $args->{'plot.type'} and $args->{'plot.type'} ne $sub_name)
2575 0 14 if (defined $args->{'plots'})
2578 0 14 if (defined $args->{'p'})