----- Original Message ----- From: "Craig DeForest" <[email protected]>
To: <[email protected]> Sent: Tuesday, September 25, 2012 2:23 PM Subject: [Perldl] PDL::Graphics::Gnuplot 1.0 available in CPAN
PDL::Graphics::Gnuplot has been tested on MacOS and several flavors of Linux. It allegedly works with Microsoft Windows (via IPC::Run) but has not been tested there.
Hi Craig,Attached is a patch (gnuplot.win32.diff) that enables PDL-G-G-1.0 to work on MS Windows. Without this patch, windows will invariably and inevitably enter the code block that prints out the warning:
print STDERR <<"EOM"WARNING: Hmmm, gnuplot didn't respond for 8 seconds. I was expecting to read
a version number. Ah, well, I'm returning the object anyway -- but don't be surprised if it doesn't work. EOMIt will then invariably and inevitably enter the code block that prints out the error:
barf <<"EOM"; Hmmm, my $suffix Gnuplot process didn't respond for $delay seconds.This could be a bug in PDL::Graphics::Gnuplot or gnuplot itself -- although for some terminals (like x11) it could be because of a
slow network. If you don't think it is a network problem, please report it as a PDL::Graphics::Gnuplot bug. You might be able to ignore this message, or you might have to restart() the object. EOMObviously, at that point it dies. This all happens because can_read() immediately returns false on Windows whenever it is called on pipes or filehandles.
This patched version also sets $fromerr to the empty string (again to avoid having the script die). And it it prints the contents of $fromerr to STDERR - so that we can at least see what $fromerr contained.
For my test program I'm using the attached synopsis1.pl. The output that it sends to the console (which is simply the contents of $fromerr) is provided in the attached console.txt.
The gnuplot graph that synopsis1.pl produces looks fine.This is just a starting point ... does anyone here have any suggestions regarding improvements to this rather lame patch that I've come up with ? (If not, I'll just submit the patch in its existing form to rt.cpan in a day or two.)
Some things that bother me:1) Note that, in console.txt, every print of $fromerr seems to be missing the final doublequote character. Also, all but the first print of $fromerr begin with a doublequote char. (Is that the doublequote that was missing from the end of the previous print ?)
2) I need to employ an <STDIN>; at the end of the script in order to keep the gnuplot window open. Is that normal ?
3) I'm not really very comfortable with having to, in essence, ignore the contents of $fromerr and re-set it to the empty string. There must be something better.
4) http://www.perlmonks.org/index.pl?node_id=942603 mentions some Win32 options to replace IO::Select::can_read(). The alternatives look non-trivial to me, but maybe I just need to look a bit closer.
For anyone interested, I've also attached demo2.pl which contains 11 demos (0 .. 10) all of which seem to work pretty well - except for #9, which hangs.
I'm using gnuplot-4.6.0 binaries from http://www.tatsuromatsuoka.com/gnuplot/Eng/winbin/ Cheers,Rob
gnuplot.win32.diff
Description: Binary data
$fromerr: ####0 last modified 2012-03-04 Build System: MS-Windows 32 bit
Copyright (C) 1986-1993, 1998, 2004, 2007-2012
Thomas Williams, Colin Kelley and many others
gnuplot home: http://www.gnuplot.info
faq, bugs, etc: type "help FAQ"
immediate help: type "help" (plot window: hit 'h')
gnuplot>
gnuplot>
gnuplot> print "xxxxxxx Synchronizing gnuplot i/o 1 xxxxxxx
#### $fromerr: #### " xxxxxxx Synchronizing gnuplot i/o 1 xxxxxxxgnuplot> set palette gnuplot> plot '-' binary array=(101) format="%double" using 1 notitle with lines gnuplot> gnuplot> gnuplot> print "xxxxxxx Synchronizing gnuplot i/o 2 xxxxxxx
#### $fromerr: #### " xxxxxxx Synchronizing gnuplot i/o 2 xxxxxxx gnuplot> set size noratio gnuplot> set view noequal gnuplot> set view 60,30,1.0,1.0gnuplot> gnuplot> gnuplot> print "xxxxxxx Synchronizing gnuplot i/o 3 xxxxxxx
#### $fromerr: #### " xxxxxxx Synchronizing gnuplot i/o 3 xxxxxxxgnuplot> set palette gnuplot> set title "Parabola with error bars" gnuplot> plot '-' binary array=(101) format="%double%double%double" using 1:2:3 title "Parabola" with xyerrorbars gnuplot> gnuplot> gnuplot> print "xxxxxxx Synchronizing gnuplot i/o 4 xxxxxxx
#### $fromerr: #### " xxxxxxx Synchronizing gnuplot i/o 4 xxxxxxx gnuplot> set size noratio gnuplot> set view noequal gnuplot> set view 60,30,1.0,1.0gnuplot> gnuplot> gnuplot> print "xxxxxxx Synchronizing gnuplot i/o 5 xxxxxxx
####
synopsis1.pl
Description: Binary data
demo2.pl
Description: Binary data
_______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
