PDLPorters / PDL-Graphics-Simple

This is an interface layer to the several PDL::Graphics modules out there. It is intended to become part of the PDL core.
https://p3rl.org/PDL::Graphics::Simple
5 stars 4 forks source link

Engine detecting problem. #1

Closed aero closed 11 years ago

aero commented 11 years ago

HI I forcely installed (because there are some test error) PDL::Graphics::Simple on Windows strawberry perl.

I tried simple example, but it can't find existing PGPLOT engine.

pdl> use PDL::Graphics::Simple;

pdl> line([1,2,3],[1,2,3]);
Trying gnuplot (PDL::Graphics::Gnuplot)...nope
Trying pgplot (PDL::Graphics::PGPLOT::Window)...nope        <--- HERE
Trying plplot (PDL::Graphics::PLplot)...ok
drzowie commented 11 years ago

Thanks, aero!

Hmmm, it would be helpful to see why PGPLOT is failing to load.

(1) please find the error message for PGPLOT. You can do this with:

pdl> use PDL::Graphics::Simple; pdl> $w=pgswin(engine=>'PGPLOT'); # should fail pdl> print $PDL::Graphics::Simple::mods->{pgplot}->{msg};

(2) Does 'use PDL::Graphics::PGPLOT::Window' work properly on your system?

Cheers, Craig

aero commented 11 years ago

(1)

pdl> use PDL::Graphics::Simple;

pdl> $w=pgswin(engine=>'PGPLOT'); # should fail  <-- Can't see any error message

pdl> print $PDL::Graphics::Simple::mods->{pgplot}->{msg};
Use of uninitialized value in print at (eval 472) line 5, <IN> line 3.

(2) yes, This code works well.

pdl> use PDL::Graphics::PGPLOT::Window

pdl> $win = pgwin();

pdl> $win->line([1,2,3],[1,2,3])
aero commented 11 years ago

Hi again. I solved the problem. On windows, PDL uses http://spdg1.sci.shizuoka.ac.jp/grwinlib/english/ for PGPLOT drawing canvas. GrWinC's PGPLOT device names on Windows are GW and CGW.

This is patch for that.

--- C:\strawberry-perl-5.16.3.1-32bit\perl\site\lib\PDL\Graphics\Simple\PGPLOT.pm.org   Tue Mar 26 07:29:04 2013
+++ C:\strawberry-perl-5.16.3.1-32bit\perl\site\lib\PDL\Graphics\Simple\PGPLOT.pm       Wed Mar 27 16:37:13 2013
@@ -63,6 +63,10 @@
        $mod->{disp_dev} = 'XWINDOW';
     } elsif($mod->{devices}->{'XSERVE'} ) {
        $mod->{disp_dev} = 'XSERVE';
+    } elsif($mod->{devices}->{'CGW'} ) {
+        $mod->{disp_dev} = 'CGW';
+    } elsif($mod->{devices}->{'GW'} ) {
+        $mod->{disp_dev} = 'GW';
     } else {
        $mod->{ok} = 0;
        return 0;
drzowie commented 11 years ago

Terrific! Thanks very much, Aero! I've included your patch (or a facsimile) and fixed a related wart at the same time. I also gave you collaborator access to the tree, so you can push things up yourself if the mood takes you.

Warm regards, Craig