Reputation: 1074
Has anyone managed to create plots with PDL (Perl Data Language) using the PDL edition of Strawberry Perl on Windows?
I installed the PDL edition of Strawberry Perl 5.30.1.1 from http://strawberryperl.com/releases.html on Windows 10 (64 bits), started PDL (pdl2), and tried to display a plot as described in the first example in the PDL Book (2015 edition):
pdl> use PDL::Graphics::Simple
pdl> imag (sin(rvals(200,200)+1))
but got
Trying gnuplot (PDL::Graphics::Gnuplot)...nope
Trying pgplot (PDL::Graphics::PGPLOT::Window)...nope
Trying plplot (PDL::Graphics::PLplot)...nope
Trying prima (PDL::Graphics::Prima)...nope
Runtime error: Sorry, all known plotting engines failed. Install one and try again.
even though gnuplot 5.2 patchlevel 6 is included in that edition of Strawberry Perl.
I discovered that gnuplot isn't detected by PDL because of a problem in Alien::Gnuplot v1.033. If I change the Windows-specific part of Alien::Gnuplot::load_gnuplot to
if($^O =~ /MSWin32/i) {
if( $exec_path =~ m/([\"\*\?\<\>\|])/ ) {
die "Alien::Gnuplot: Invalid character '$1' in path to gnuplot -- I give up" ;
}
use Win32::Job;
my $job = Win32::Job->new;
open my $ofh, ">$file";
if (defined $ofh) {
my $pid = $job->spawn(undef, qq{"$exec_path" ${file}_gzinta},
{ no_window => 1, stdout => $ofh, stderr => $ofh });
if (defined $pid) {
$job->run(3); # wait at most 3 seconds for job to finish
}
}
}
then running the PDL example yields:
Trying gnuplot (PDL::Graphics::Gnuplot)...PDL::Graphics::SImple: Gnuplot exists but yours doesn't support either the x11 or wxt terminal
Trying pgplot (PDL::Graphics::PGPLOT::Window)...nope
Trying plplot (PDL::Graphics::PLplot)...nope
Trying prima (PDL::Graphics::Prima)...nope
Runtime error: Sorry, all known plotting engines failed. Install one and try again.
so then gnuplot is detected but apparently fails to meet some additional requirements.
So it appears that the version of gnuplot shipped with the PDL Edition of Strawberry Perl 5.30.1.1 on Windows is unsuitable for use by PDL, even if the Alien::Gnuplot problem is fixed -- but it seems odd that a random user (me) should be the first to notice this. Or am I doing something wrong?
I reported this apparent bug at https://rt.cpan.org/Ticket/Display.html?id=131361, but am interested in the experiences of other users with this edition on Windows.
EDIT 2020-01-10: https://pdl.perl.org says that the PDL edition of Strawberry Perl is "the absolute easiest way" to install PDL on Windows, and doesn't mention anything else that needs to be installed then.
It also mentions an "alternative easy way" that involves explicitly installing PGPLOT, which is one of the other graphical engines that PDL tried to use.
The implication is that the "absolute easiest way" does not require additional work to install a graphical engine, but my experience is different.
My question isn't "What other stuff do I need to install to enable my PDL to use a graphical engine?". I want to know if it can work out of the box, as the "absolute easiest way" implies.
Upvotes: 2
Views: 292
Reputation: 2062
PDL graphics support for Windows is unfortunately somewhat thin at the time of writing. The demo 3d
command works (demonstrating PDL::Graphics::TriD
), but the various graphics drivers supported by PDL::Graphics::Simple
are, as you note, underfunctional in various ways.
The good news is that moves are underfoot to rectify this - see Alien::PLplot
for instance, intended to allow installing PLplot on Windows. Please see the various modules' GitHub pages for currently-tracked issues if you'd like to help (either with coding, or testing, or even just reporting specific problems):
Upvotes: 1