Skip to content

Commit 982e0e5

Browse files
committed
PGPLOT whitespace
1 parent 40d6765 commit 982e0e5

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

lib/PDL/Graphics/Simple/PGPLOT.pm

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
######################################################################
55
###
66
###
7-
### PGPLOT interface to PDL::Graphics::Simple.
7+
### PGPLOT interface to PDL::Graphics::Simple.
88
###
99
### See the PDL::Graphics::Simple docs for details
1010
###
@@ -60,19 +60,19 @@ sub check {
6060
$mod->{disp_dev} = $ENV{PDL_SIMPLE_DEVICE} || $ENV{PGPLOT_DEV};
6161
$mod->{disp_dev} =~ s#^/+##;
6262
} else {
63-
TRY:for my $try(qw/XWINDOW XSERVE CGW GW/){
64-
if($mod->{devices}->{$try}) {
63+
TRY:for my $try (qw/XWINDOW XSERVE CGW GW/) {
64+
if ($mod->{devices}->{$try}) {
6565
$mod->{disp_dev} = $try;
6666
last TRY;
6767
}
6868
}
6969
}
70-
unless(exists($mod->{disp_dev})){
70+
unless (exists($mod->{disp_dev})) {
7171
$mod->{ok} = 0;
7272
$mod->{msg} = "Couldn't identify a PGPLOT display device -- giving up.\n";
7373
return 0;
7474
}
75-
unless( $mod->{devices}{VCPS} ) {
75+
unless ($mod->{devices}{VCPS}) {
7676
$mod->{ok} = 0;
7777
$mod->{msg} = "Couldn't find the VCPS file-output device -- giving up.\n";
7878
return 0;
@@ -170,7 +170,7 @@ our $pgplot_methods = {
170170
'image' => 'imag',
171171
'contours' => 'cont',
172172
fits => 'fits_imag',
173-
'circles'=> sub {
173+
'circles'=> sub {
174174
my ($me,$ipo,$data,$ppo) = @_;
175175
$ppo->{filltype}='outline';
176176
$me->{obj}->tcircle(@$data, $ppo);
@@ -187,31 +187,28 @@ our $pgplot_methods = {
187187
$me->{obj}->text( $s, $data->[0]->at($i), $data->[1]->at($i), {JUSTIFICATION=>$j} );
188188
}
189189
}
190-
191190
};
192191

193192
sub plot {
194193
my $me = shift;
195194
my $ipo = shift;
196195
my $po = {};
197-
$po->{title} = $ipo->{title} if(defined($ipo->{title}));
198-
$po->{xtitle}= $ipo->{xlabel} if(defined($ipo->{xlabel}));
199-
$po->{ytitle}= $ipo->{ylabel} if(defined($ipo->{ylabel}));
200-
$po->{justify}= $ipo->{justify} if(defined($ipo->{justify}));
196+
$po->{title} = $ipo->{title} if defined $ipo->{title};
197+
$po->{xtitle} = $ipo->{xlabel} if defined $ipo->{xlabel};
198+
$po->{ytitle} = $ipo->{ylabel} if defined $ipo->{ylabel};
199+
$po->{justify} = $ipo->{justify} if defined $ipo->{justify};
201200

202201
my %color_opts;
203-
if (defined($ipo->{crange})) {
202+
if (defined $ipo->{crange}) {
204203
$color_opts{MIN} = $ipo->{crange}[0] if defined $ipo->{crange}[0];
205204
$color_opts{MAX} = $ipo->{crange}[1] if defined $ipo->{crange}[1];
206205
}
207206

208-
my $more = 0;
209-
210-
if($ipo->{oplot} and $me->{opt}->{type} =~ m/^f/i) {
207+
if ($ipo->{oplot} and $me->{opt}->{type} =~ m/^f/i) {
211208
die "The PGPLOT engine does not yet support oplot for files. Instead, \nglom all your lines together into one call to plot.\n";
212209
}
213210

214-
unless($ipo->{oplot}) {
211+
unless ($ipo->{oplot}) {
215212
$me->{curvestyle} = 0;
216213
$me->{logaxis} = $ipo->{logaxis};
217214
$po->{axis} = 0;
@@ -228,7 +225,7 @@ sub plot {
228225
$me->{obj}->env(@range_vals, $po) if grep defined, @range_vals;
229226
}
230227

231-
# ppo is "post-plot options", which are really a mix of plot and curve options.
228+
# ppo is "post-plot options", which are really a mix of plot and curve options.
232229
# Currently we don't parse any plot options into it (they're handled by the "env"
233230
# call) but if we end up doing so, it should go here. The linestyle and color
234231
# are curve options that are autoincremented each curve.
@@ -310,7 +307,7 @@ sub plot {
310307
$yp = 0.6 * $yrdiff + $ipo->{yrange}->[0];
311308
}
312309
print "keys is [".join(",",@{$me->{keys}})."]; xp is $xp; yp is $yp\n";
313-
$me->{obj}->legend(
310+
$me->{obj}->legend(
314311
$me->{keys},
315312
$xp, $yp,
316313
{ Color => [ (xvals(0+@{$me->{keys}}) % 7 + 1)->list ],

t/simple.t

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ is_deeply \@args, [
9696
];
9797
}
9898
eval { $a = xvals(50); lines $a sin($a/3), {xlabel=>"Abscissa", ylabel=>"Ordinate"} };
99-
plan skip_all => 'No plotting engines installed' if $@ =~ /Sorry, all known/;
10099
is($@, '', "simple lines plot succeeded");
101100
ok( defined($PDL::Graphics::Simple::global_object), "Global convenience object got spontaneously set" );
102101
ask_yn q{ test> $a = xvals(50); lines $a sin($a/3);

0 commit comments

Comments
 (0)