PDLPorters/PDL-Graphics-Gnuplot

setting option justify=>0 should delete 'size' and 'justify' options

Closed this issue · 0 comments

Running this code to display an unjustified, then justified, then unjustified image:

$w=gpwin("wxt");
$r = rvals(11,11);
print %{$w->options}; print "\n";
$w->image($r);
$w->options(justify=>1);
print %{$w->options}; print "\n";
print @{$w->options->{size}}; print"\n";
$w->image($r);
eval {$w->options(justify=>0);};
if ($@) {print "Error: $@" . "Continuing anyway\n";}
delete $w->options->{size};
delete $w->options->{justify};
$w->image($r);

Prints this output:

terminal wxt dashed nopersist multiplot 0 output
justify size ARRAY(0x7fcb3c933e10) terminal wxt dashed nopersist output multiplot 0
ratio -1
Error: Not an ARRAY reference at /Users/derek/local/lib/perl5/PDL/Graphics/Gnuplot.pm line 4840, line 173.
Continuing anyway

And results in 3 images being displayed: the first and third unjustified, the second justified.

It would be nice that error didn't occur when setting justify=>0, and instead it deleted (or modified, I'm not an expert in all the possible permutations) the size option from the options hash, and subsequently deleted the justify option as well.