| 1 | package CXC::Gnuplot::V0::MultiPlot; | ||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use v5.38; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use experimental 'builtin', 'declared_refs'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Feature::Compat::Class; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||
| 7 | 1 | our $VERSION = 'v0.29.3'; | |||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||
| 9 | class CXC::Gnuplot::V0::MultiPlot; | ||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use builtin 'true', 'false'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||
| 13 | use CXC::Gnuplot::V0::Util | ||||||||||||||||||||||||||||||||||||||
| 14 | 1 | -lexical => 'maybe_quote', | |||||||||||||||||||||||||||||||||||||
| 15 | 'assert_coerce_object', 'clone_object', 'pvalidate', 'pvalidate_xy_pair', 'to_hash_r', | ||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | 'render_opts', 'render_set', 'flatten_array'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||
| 18 | use CXC::Gnuplot::V0::Types | ||||||||||||||||||||||||||||||||||||||
| 19 | 1 | -lexical => 'Dict', | |||||||||||||||||||||||||||||||||||||
| 20 | 'Enum', | ||||||||||||||||||||||||||||||||||||||
| 21 | 'Maybe', | ||||||||||||||||||||||||||||||||||||||
| 22 | 'MultiPlotLayout', | ||||||||||||||||||||||||||||||||||||||
| 23 | 'Num', | ||||||||||||||||||||||||||||||||||||||
| 24 | 'Optional', | ||||||||||||||||||||||||||||||||||||||
| 25 | 'SetFormats', | ||||||||||||||||||||||||||||||||||||||
| 26 | 1 | ▶ | 'signature_for'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | no namespace::clean; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||
| 30 | 1 | ▶ | use Ref::Util 'is_hashref'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | use constant XYPair => Num | Dict [ x => Num, y => Optional [ Maybe [Num] ] ]; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||
| 34 | 1 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||
| 36 | my sub croak { | ||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | require Carp; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
croak: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 38 | 0 | goto \&Carp::croak; | |||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||
| 41 | #<<< no tidy | ||||||||||||||||||||||||||||||||||||||
| 42 | 1 | field $title :param :reader = undef; | |||||||||||||||||||||||||||||||||||||
| 43 | 1 | field $layout :param :reader = undef; | |||||||||||||||||||||||||||||||||||||
| 44 | 1 | field $order :param :reader = undef; | |||||||||||||||||||||||||||||||||||||
| 45 | 1 | field $direction :param :reader = undef; | |||||||||||||||||||||||||||||||||||||
| 46 | 1 | field $scale :param :reader = undef; | |||||||||||||||||||||||||||||||||||||
| 47 | 1 | field $offset :param :reader = undef; | |||||||||||||||||||||||||||||||||||||
| 48 | 1 | field $margins :param :reader = undef; | |||||||||||||||||||||||||||||||||||||
| 49 | 1 | field $spacing :param :reader = undef; | |||||||||||||||||||||||||||||||||||||
| 50 | #>>> | ||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||
| 76 | ADJUST { | ||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | pvalidate( title => 'MultiPlot::Title' => \$title ); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||
| 79 | 0 | pvalidate( margins => 'MultiPlot::Margins' => \$margins ); | |||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||
| 81 | 0 | pvalidate_xy_pair( spacing => XYPair, \$spacing ); | |||||||||||||||||||||||||||||||||||||
| 82 | defined $spacing | ||||||||||||||||||||||||||||||||||||||
| 83 | and !defined $spacing->{y} | ||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | and delete $spacing->{y}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $spacing and not defined $spacing->{"y"}
MC/DC0%0/2
defined $spacing and not defined $spacing->{"y"}
defined $spacing
not defined $spacing->{"y"}
Truth table0%0/3
A and not(B)
A= defined $spacingB= not defined $spacing->{"y"}
| |||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||
| 86 | 0 | pvalidate_xy_pair( offset => XYPair, \$offset ); | |||||||||||||||||||||||||||||||||||||
| 87 | defined $offset | ||||||||||||||||||||||||||||||||||||||
| 88 | and !defined $offset->{y} | ||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | and delete $offset->{y}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $offset and not defined $offset->{"y"}
MC/DC0%0/2
defined $offset and not defined $offset->{"y"}
defined $offset
not defined $offset->{"y"}
Truth table0%0/3
A and not(B)
A= defined $offsetB= not defined $offset->{"y"}
| |||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||
| 91 | 0 | pvalidate_xy_pair( scale => XYPair, \$scale ); | |||||||||||||||||||||||||||||||||||||
| 92 | defined $scale | ||||||||||||||||||||||||||||||||||||||
| 93 | and !defined $scale->{y} | ||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | and delete $scale->{y}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $scale and not defined $scale->{"y"}
MC/DC0%0/2
defined $scale and not defined $scale->{"y"}
defined $scale
not defined $scale->{"y"}
Truth table0%0/3
A and not(B)
A= defined $scaleB= not defined $scale->{"y"}
| |||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||
| 96 | 0 | pvalidate( order => Enum [ 'rowsfirst', 'columnsfirst' ], \$order ); | |||||||||||||||||||||||||||||||||||||
| 97 | 0 | pvalidate( direction => Enum [ 'downwards', 'upwards' ], \$direction ); | |||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||
| 99 | 0 | pvalidate( layout => MultiPlotLayout, \$layout ); | |||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||
| 106 | method to_hash { | ||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | to_hash_r( { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
to_hash: not called CC=9 SCAR=45.0
Pod
documented
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||
| 109 | ( defined $title ? ( title => $title ) : () ), | ||||||||||||||||||||||||||||||||||||||
| 110 | ( defined $layout ? ( layout => { $layout->%* } ) : () ), | ||||||||||||||||||||||||||||||||||||||
| 111 | ( defined $order ? ( order => $order ) : () ), | ||||||||||||||||||||||||||||||||||||||
| 112 | ( defined $direction ? ( direction => $direction ) : () ), | ||||||||||||||||||||||||||||||||||||||
| 113 | ( defined $scale ? ( scale => $scale ) : () ), | ||||||||||||||||||||||||||||||||||||||
| 114 | ( defined $offset ? ( offset => $offset ) : () ), | ||||||||||||||||||||||||||||||||||||||
| 115 | ( defined $margins ? ( margins => $margins ) : () ), | ||||||||||||||||||||||||||||||||||||||
| 116 | ( defined $spacing ? ( spacing => $spacing ) : () ), | ||||||||||||||||||||||||||||||||||||||
| 117 | } ); | ||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||
| 124 | ▶ | sub assert_coerce( $class, $args ) { | |||||||||||||||||||||||||||||||||||||
|
Subroutine
assert_coerce: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 125 | 0 | assert_coerce_object( $class, $args ); | |||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||
| 132 | ▶ | method clone ( %args ) { | |||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 133 | 0 | clone_object( $self, \%args ); | |||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||
| 140 | 1 | signature_for opts => ( | |||||||||||||||||||||||||||||||||||||
| 141 | method => 1, | ||||||||||||||||||||||||||||||||||||||
| 142 | named => [ | ||||||||||||||||||||||||||||||||||||||
| 143 | as => SetFormats, | ||||||||||||||||||||||||||||||||||||||
| 144 | { default => 'array' }, | ||||||||||||||||||||||||||||||||||||||
| 145 | ], | ||||||||||||||||||||||||||||||||||||||
| 146 | ); | ||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||
| 148 | method opts ( $opt ) { | ||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||
| 150 | my @opts; | ||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||
| 152 | push @opts, render_opts( title => $title ); | ||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||
| 154 | if ( defined $layout ) { | ||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||
| 156 | push @opts, [ layout => join( q{,}, $layout->{nrows}, $layout->{ncols} ) ]; | ||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||
| 158 | defined $order | ||||||||||||||||||||||||||||||||||||||
| 159 | and push @opts, $order; | ||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||
| 161 | defined $direction | ||||||||||||||||||||||||||||||||||||||
| 162 | and push @opts, $direction; | ||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||
| 164 | defined $scale | ||||||||||||||||||||||||||||||||||||||
| 165 | and push @opts, [ scale => join( q{,}, grep defined, $scale->@{ 'x', 'y' } ) ]; | ||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||
| 167 | defined $offset | ||||||||||||||||||||||||||||||||||||||
| 168 | and push @opts, [ offset => join( q{,}, grep defined, $offset->@{ 'x', 'y' } ) ]; | ||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||
| 170 | push @opts, render_opts( margins => $margins ); | ||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||
| 172 | defined $spacing | ||||||||||||||||||||||||||||||||||||||
| 173 | and push @opts, [ spacing => join( q{,}, grep defined, $spacing->@{ 'x', 'y' } ) ]; | ||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||
| 177 | return | ||||||||||||||||||||||||||||||||||||||
| 178 | $opt->as eq 'array' ? @opts | ||||||||||||||||||||||||||||||||||||||
| 179 | : $opt->as eq 'flatten_array' ? map { flatten_array( $_ ) } @opts | ||||||||||||||||||||||||||||||||||||||
| 180 | : $opt->as eq 'string' ? join q{ }, map { flatten_array( $_ )->@* } @opts | ||||||||||||||||||||||||||||||||||||||
| 181 | : croak( 'unknown format: ' . $opt->as ); | ||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||
| 188 | 1 | signature_for set => ( | |||||||||||||||||||||||||||||||||||||
| 189 | method => 1, | ||||||||||||||||||||||||||||||||||||||
| 190 | named => [ | ||||||||||||||||||||||||||||||||||||||
| 191 | as => SetFormats, | ||||||||||||||||||||||||||||||||||||||
| 192 | { default => 'string' }, | ||||||||||||||||||||||||||||||||||||||
| 193 | ], | ||||||||||||||||||||||||||||||||||||||
| 194 | ); | ||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||
| 196 | method set ( $opt ) { | ||||||||||||||||||||||||||||||||||||||
| 197 | return render_set( [ render_opts( [ set => 'multiplot' ], $self ) ], $opt->as ); | ||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||
| 200 | 1 | 1; | |||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||
| 202 | # | ||||||||||||||||||||||||||||||||||||||
| 203 | # This file is part of CXC-Gnuplot | ||||||||||||||||||||||||||||||||||||||
| 204 | # | ||||||||||||||||||||||||||||||||||||||
| 205 | # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory. | ||||||||||||||||||||||||||||||||||||||
| 206 | # | ||||||||||||||||||||||||||||||||||||||
| 207 | # This is free software, licensed under: | ||||||||||||||||||||||||||||||||||||||
| 208 | # | ||||||||||||||||||||||||||||||||||||||
| 209 | # The GNU General Public License, Version 3, June 2007 | ||||||||||||||||||||||||||||||||||||||
| 210 | # | ||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||
| 212 | __END__ | ||||||||||||||||||||||||||||||||||||||