Skip to content

Commit 6f47666

Browse files
committed
exception when oplot in multiplot mode
1 parent 1fc7bf8 commit 6f47666

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

Changes

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
- exception when oplot in multiplot mode
2+
13
1.013 2024-09-24
24
- adjust tests to avoid spurious "UNKNOWN" results
35

lib/PDL/Graphics/Simple.pm

+7-13
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,9 @@ a single array ref containing (nx, ny). Subsequent calls to plot
415415
send graphics to subsequent locations on the window. The ordering
416416
is always horizontal first, and left-to-right, top-to-bottom.
417417
418+
B<NOTE> for multiplotting: C<oplot> does not work and will cause an
419+
exception. This is a limitation imposed by Gnuplot.
420+
418421
=back
419422
420423
=cut
@@ -849,8 +852,7 @@ sub _translate_plot {
849852
@$po{keys %$h} = values %$h;
850853
}
851854

852-
my $called_from_imag = $po->{called_from_imag};
853-
delete $po->{called_from_imag};
855+
my $called_from_imag = delete $po->{called_from_imag};
854856

855857
$po = $plot_options->options($po);
856858
$po->{oplot} = 1 if $held;
@@ -950,7 +952,6 @@ sub _translate_plot {
950952
push @args, shift;
951953
}
952954

953-
954955
##############################
955956
# Most array refs get immediately converted to
956957
# PDLs. But the last argument to a "with=labels" curve
@@ -1078,6 +1079,7 @@ sub _translate_plot {
10781079
sub plot {
10791080
my $obj = &_invocant_or_global;
10801081
my @args = _translate_plot(@$obj{qw(held keys)}, @_);
1082+
barf "Can't oplot in multiplot" if $obj->{params}{multi} and $args[1]{oplot};
10811083
$obj->{obj}{keys} = $obj->{keys} = shift @args;
10821084
$obj->{obj}->plot(@args);
10831085
}
@@ -1099,16 +1101,8 @@ so that the plot will be overlain on the previous one.
10991101
=cut
11001102

11011103
sub oplot {
1102-
my $h;
1103-
1104-
if(ref($_[$#_]) eq 'HASH') {
1105-
$h = $_[$#_];
1106-
} else {
1107-
$h = {};
1108-
push @_, $h;
1109-
}
1110-
$h->{replot} = 1;
1111-
1104+
push @_, {} if ref($_[-1]) ne 'HASH';
1105+
$_[-1]{oplot} = 1;
11121106
plot(@_);
11131107
}
11141108

0 commit comments

Comments
 (0)