Skip to content

Commit

Permalink
fix {colorbox=>1} - #100
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Apr 20, 2024
1 parent 4486a9b commit e0eaec2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- fix {colorbox=>1} (#100)

2.025 2024-04-20
- Split version checking from `use Alien::Gnuplot` line for easier downstream
packaging. Fixes #98.
Expand Down
10 changes: 5 additions & 5 deletions lib/PDL/Graphics/Gnuplot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5211,7 +5211,7 @@ our $cOptionsTable = {
],
'using' => ['l','cl',undef,6], # using clauses in order (straight passthrough)
# legend is a special case -- it gets parsed as a list but emitted as a quoted scalar.
'legend' => ['l', sub { if(defined($_[1]) and defined $_[1][0]) {return "title \"$_[1][0]\"";} else {return "notitle"}},
'legend' => ['ln', sub { if(defined($_[1]) and defined $_[1][0]) {return "title \"$_[1][0]\"";} else {return "notitle"}},
undef, 7],
'axes' => [['(x[12])(y[12])'],'cs',undef,8],
'smooth' => ['s','cs',undef,8.1],
Expand Down Expand Up @@ -5568,10 +5568,10 @@ $_pOHInputs = {

## one-line list (can also be boolean)
l => sub { return $_[1] if !defined $_[1] or !length $_[1] or ref $_[1] eq 'ARRAY';
return [$_[1]] if( (!ref($_[1])) && "$_[1]" =~ m/^\s*\-?\d+\s*$/); # nonzero integers yield true
# Not setting a boolean value - it's a list (or a trivial list).
# anything that's not an array ref (and not a number) gets put in the array
return [$_[1]];
return $_[1] if !ref($_[1]) && "$_[1]" =~ m/^\s*\-?\d+\s*$/; # nonzero integers yield true
# Not setting a boolean value - it's a list (or a trivial list).
# anything that's not an array ref (and not a number) gets put in the array
return [$_[1]];
},

## one-line list (no booleanity: scalars always get copied to the list)
Expand Down
7 changes: 7 additions & 0 deletions t/plot.t
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ unlink($testoutput) or warn "\$!: $! for '$testoutput'";
like $text, qr/unset multiplot/, 'end_multi_generate';
}

{
my $w = gpwin('dumb',size=>[79,24,'ch'], output=>$testoutput);
my $r9 = rvals(9,9);
eval {$w->plot({colorbox => 1},{with => 'image'},$r9->xvals,$r9->yvals,$r9)};
is($@, '', "colorbox succeeded");
}

if ($PDL::Graphics::Gnuplot::gp_version >= 4.7) { # only 4.7+
$w = gpwin('dumb',size=>[79,24,'ch'], output=>$testoutput);
$w->multiplot(layout=>[1,2]);
Expand Down

0 comments on commit e0eaec2

Please sign in to comment.