You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using PDL::Graphics::Gnuplot version 2.024, PDL 2.080, Perl 5.34.1:
use PDL::Graphics::Gnuplot
$w=gpwin("wxt",size=>6);
$x=xvals(10); $y = $x**2;
$w->plot({with=>'lines',legend=>'parabola'},$x,$y);
$w->plot({with=>'lines',legend=>'123parabola'},$x,$y);
$w->plot({with=>'lines',legend=>'456'},$x,$y);
Can't use string ("456") as an ARRAY ref while "strict refs" in use at /Users/derek/Build/PDL-Graphics-Gnuplot/blib/lib/PDL/Graphics/Gnuplot.pm line 3867.
The text was updated successfully, but these errors were encountered:
It's the evaluation of @{$chunk{options}->{legend}} in Gnuplot.pm that's causing the error.
I didn't go digging, but I can only think that, somehow, with 'parabola' and '123parabola' $chunk{options}{legend} is set to something like['parabola'] and (respectively) ['123parabola'], but with '456' it's set to'456'.
Maybe something along the lines of what is accomplished by this silly little script:
use strict;
use warnings;
use Scalar::Util 'looks_like_number';
for ('parabola', '123parabola', '456') {
my $arg;
if(!looks_like_number($_)) {$arg = [$_]}
else {$arg = $_}
my %h = ('legend', $arg);
my %chunk = ('options', \%h);
print "ok: $_\n" if @{$chunk{options}->{legend}};
}
__END__
Outputs:
ok: parabola
ok: 123parabola
Can't use string ("456") as an ARRAY ref while "strict refs" in use at try.pl line 11.
Using PDL::Graphics::Gnuplot version 2.024, PDL 2.080, Perl 5.34.1:
The text was updated successfully, but these errors were encountered: