Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
Your skill will accomplish
what the force of many cannot
 
PerlMonks

Chart::Gnuplot and Windows XP

by dHarry (Priest)
 | Log in | Create a new user | The Monastery Gates | Super Search | 
 | Seekers of Perl Wisdom | Meditations | PerlMonks Discussion | 
 | Obfuscation | Reviews | Cool Uses For Perl | Perl News | Q&A | Tutorials | 
 | Poetry | Recent Threads | Newest Nodes | Donate | What's New | 

on Nov 05, 2008 at 10:39 UTC ( #721599=perlquestion: print w/ replies, xml ) Need Help??
dHarry has asked for the wisdom of the Perl Monks concerning the following question:

Dear venerable wise ones

I want to create some 2D plots and went for Chart::Gnuplot

Both Chart::Gnuplot and gnuplot install fine. Gnuplot works. When I try a simple Perl example it fails, error message: 'gnuplot' is not recognized as an internal or external command,operable program or batch file. Not a surprise since Chart::Gnuplot issues a gnuplot command. Under Windows this is not available, instead it’s called wgnuplot.exe. I googled and tried a few suggested solutions, like creating a gnuplot.bat file pointing to the right file, this fails. Next I investigated building gnuplot from the sources but then you end up with the same wgnuplot.exe.

Has anybody made Chart::Gnuplot with gnuplot work under Windows XP? Or is this yet another reason to change OS?!

Comment on Chart::Gnuplot and Windows XP
Re: Chart::Gnuplot and Windows XP
by BrowserUk (Apostle) on Nov 05, 2008 at 11:25 UTC
    'gnuplot' is not recognized as an internal or external command,operable program or batch file.

    If you put a file called gnuplot.bat somewhere it can be found through your path environment variable, it should work fine.

    Or you could rename (or make a copy of) wgnuplot.exe called gnuplot.exe. Again, it would need to be located somewhere on your path.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      Changing the name of the executable gives an "Invalid Parameter - 90" error.

      Using a .bat file: "C:\gnuplot\binaries\wgnuplot.exe" %1 results in the call C:\workspace\Testbed>"C:\gnuplot\binaries\wgnuplot.exe" \tmp\NTEVfipQVM/plot and gives the same error.

        I suspect, but am not in a position to confirm just now, that the problem is this forward slash:

        \tmp\NTEVfipQVM/plot ................^

        And that if you modified Chart::Gnuplot something along the lines of:

        sub new { my ($class, %hash) = @_; # Create temporary file to store Gnuplot instructions if (!defined $hash{_multiplot}) # if not in multiplot mode { my $dirTmp = tempdir(CLEANUP => 1, DIR => '/tmp'); ########### change here $hash{_script} = $^O eq 'MSWin32' ? "$dirTmp\plot" : "$dirTmp/ +plot";

        Then it might work.

        Of course, there are probably other places (like the line above) that might need similar treatment--and there are certainly better ways (File::Spec and friends) of making the path handling properly cross-platform--, but a few simple changes like this might allow you to get on with your work.

        And if you fed what changes you need, back to the module author, they might be able to integrate them back into the next release.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Chart::Gnuplot and Windows XP
by Anonymous Monk on Nov 05, 2008 at 11:27 UTC
    Has anybody made Chart::Gnuplot with gnuplot work under Windows XP? Or is this yet another reason to change OS?!
    Wow, just wow, the drama :)
    # Create chart object and specify the properties of the chart my $chart = Chart::Gnuplot->new( output => "fig/simple.png", title => "Simple testing", xlabel => "My x-axis label", ylabel => "My y-axis label", .... gnuplot => "dramaqueen.exe", );
    http://search.cpan.org/~kwmak/Chart-Gnuplot-0.05/lib/Chart/Gnuplot.pm#gnuplot

      Bless you brother, I completely missed the gnuplot => "path to exe" option. However, also in this case I get an Invalid Parameter - 90 error message.

        Based on your other reply, it seems that you are mixing "/" and "\" directory separators in your chart's file name. Try not to... :-)

        the file name should either be
        \tmp\NTEVfipQVM\plot or
        /tmp/NTEVfipQVM/plot but not
        \tmp\NTEVfipQVM/plot ...

        []s, HTH, Massa (κς,πμ,πλ)
        However, also in this case I get an Invalid Parameter - 90 error message

        I'm starting to get the feeling that the gnuplot executable and wgnuplot.exe must take different arguments.

        Cheers,
        Rob
        Hmm, works for me :/

        I used gp424win32.zip from here.

        I also removed DIR => '/tmp' from Gnuplot.pm, because I like my existing temp directory just fine.

Re: Chart::Gnuplot and Windows XP
by BrowserUk (Apostle) on Nov 05, 2008 at 23:38 UTC

    A little more information now I've gotten to downloading the gnuplot package. There seem to be a lot of problems with Chart::Gnuplot.

    Amongst others,

    • you need to code the output file thusly:     output => 'c:\\\\test\\\\test.png', in order to get 'c:\\test\\test.png' into the command file. Otherwise you get the Invalid Parameter - 90 error.

      You'll also get that same error if the output file already exists.

    • The output produced (once you get it to actually produce output!), is initially not the .png you are specify, but rather an EPS format file. (with a .png extension).

      Chart::Gnuplot then goes looking for a convert utility (from the ImageMagick distribution), to translate that into the required .png (gif, bmp etc.)

      Depending upon the output format required, it will also go looking for a couple of other utilities, ps2pdf, pdf2ps which are also not a part of the distribution. I'm not sure where they come from.

    It looks like it would take some serious work (and therefore a serious need!) to get this working under windows.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Login:
Password
remember me
What's my password?
Create A New User

Node Status?
node history
Node Type: perlquestion [id://721599]
Approved by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (23)
BrowserUk
merlyn
Corion
GrandFather
shmem
jdporter
Your Mother
toolic
holli
Gavin
atcroft
dhoss
kennethk
MidLifeXis
thezip
Eyck
pileofrogs
clinton
Utilitarian
bichonfrise74
ssandv
MikeDexter
im2
As of 2010-02-09 20:21 GMT
Sections?
The Monastery Gates
Seekers of Perl Wisdom
Meditations
PerlMonks Discussion
Categorized Q&A
Tutorials
Obfuscated Code
Perl Poetry
Cool Uses for Perl
Perl News
Information?
PerlMonks FAQ
Guide to the Monastery
What's New at PerlMonks
Voting/Experience System
Tutorials
Reviews
Library
Perl FAQs
Other Info Sources
Find Nodes?
Nodes You Wrote
Super Search
List Nodes By Users
Newest Nodes
Recently Active Threads
Selected Best Nodes
Best Nodes
Worst Nodes
Saints in our Book
Leftovers?
The St. Larry Wall Shrine
Offering Plate
Awards
Craft
Snippets Section
Code Catacombs
Quests
Editor Requests
Buy PerlMonks Gear
PerlMonks Merchandise
Planet Perl
Perlsphere
Use Perl
Perl.com
Perl 5 Wiki
Perl Jobs
Perl Mongers
Perl Directory
Perl documentation
CPAN
Random Node
Voting Booth?

What level of existential comfort do you require?

Palace
Executive suite at the best hotel
Regular hotel in a decent part of town
Motel
Boarding house
Sleeping Bag on Couch in Basement
Any port in a storm
Camping under the freeway overpass
Jail
Other

Results (279 votes), past polls