Skip to content

Commit

Permalink
demo to use with=>"fits", test that
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed May 19, 2024
1 parent 3c4fe06 commit 5f82865
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/PDL/Demos/Gnuplot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if($PDL::Graphics::Gnuplot::valid_terms->{wxt}) {
} elsif($ENV{DISPLAY}) {
$subst = "x11, size=>[8,6,'in'], title=>'Gnuplot demo window', persist=>0";
}
my @d = ( "PDL", "Demos" );
my @d = qw(PDL Demos);
our $m51path = undef;
foreach my $path ( @INC ) {
my $check = File::Spec->catfile( $path, @d, "m51.fits" );
Expand Down Expand Up @@ -212,7 +212,8 @@ EOF
$m51 = rfits $|.__PACKAGE__.q|::m51path;
$w->reset;
$w->image({j=>1, clut=>'gray', title=>"M51 galaxy"}, with=>'image',$m51 );
# note this uses the 'fits' plot type, which adjusts the coordinates
$w->image({j=>1, clut=>'gray', title=>"M51 galaxy"}, with=>'fits',$m51 );
|],

[act => q|
Expand Down
12 changes: 12 additions & 0 deletions t/plot.t
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,18 @@ bless($a,'MyPackage');
eval { $w->plot( $a ); };
is $@, '', "subclass of PDL plots OK";

my @d = qw(PDL Demos);
my $m51path;
foreach my $path (@INC) {
my $check = File::Spec->catfile( $path, @d, "m51.fits" );
if ( -f $check ) { $m51path = $check; last; }
}
if (defined $m51path) {
my $m51 = rfits $m51path;
eval { $w->reset; $w->plot(with => 'fits', $m51); }; # reset of "ascii"
is $@, '', "with => 'fits' OK";
}

# Test terminal defaulting
eval { $w=PDL::Graphics::Gnuplot::new(size=>[9,9]); undef($w);};
is $@, '', "default terminal is selected OK";
Expand Down

0 comments on commit 5f82865

Please sign in to comment.