Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Graphing in perl

by surfmonkey (Acolyte)
on Apr 23, 2002 at 12:32 UTC ( #161271=perlquestion: print w/replies, xml ) Need Help??
surfmonkey has asked for the wisdom of the Perl Monks concerning the following question:

Are there any modules that allow you to create graphs in Perl on a windows box? The GD modules appear to be Unix only, or am I missing something?

Replies are listed 'Best First'.
Re: Graphing in perl
by strat (Canon) on Apr 23, 2002 at 12:36 UTC
    I've just tried and found GD installed on my Win2k-Box/ActivePerl 631. I executed the first code from perldoc GD, and it seems to work fine...

    H:\>perl use GD; # create a new image $im = new GD::Image(100,100); # allocate some colors $white = $im->colorAllocate(255,255,255); $black = $im->colorAllocate(0,0,0); $red = $im->colorAllocate(255,0,0); $blue = $im->colorAllocate(0,0,255); # make the background transparent and interlaced $im->transparent($white); $im->interlaced('true'); # Put a black frame around the picture $im->rectangle(0,0,99,99,$black); # Draw a blue oval $im->arc(50,50,95,75,0,360,$blue); # And fill it with red $im->fill(50,50,$red); # make sure we are writing to a binary stream binmode STDOUT; # Convert the image to PNG and print it on standard output print $im->png; ^Z PNG ..... and so on
    But somehow, I've never worked with graphical graphs yet.

    Best regards,
    perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"

Re: Graphing in perl
by cjf (Parson) on Apr 23, 2002 at 12:40 UTC
    The GD modules appear to be Unix only, or am I missing something

    GD::Graph shows up with a passing grade on windows. A search for 'graph' also turns up a bunch of relevant results.

Re: Graphing in perl
by Necos (Friar) on Apr 23, 2002 at 16:14 UTC
    If anyone is interested in doing scientific plots (of course, it requires GD to be installed), there is a really nice module for GNUPlot. I use this for my radiation class to do plots of nuclear decays and such with just a little effort. The whole Chart::Plot line of modules (including Chart::Plot::GnuPlot) seem to work under Windows. The only problem with GnuPlot is that it was made with *nix/*nux filesystems in mind. To fix that we just add a:
    in the Chart::Graph module (I'll double check the hack I used to get it to work) and all is fine. When I get to school, I'll post the modifications to the module, as well as a sample script I wrote.

    Theodore Charles III
    Network Administrator
    Los Angeles Senior High
    4650 W. Olympic Blvd.
    Los Angeles, CA 90019
    323-937-3210 ext. 224
    perl -e "map{print++$_}split//,Mdbnr;"
Re: Graphing in perl
by gryphon (Abbot) on Apr 23, 2002 at 16:05 UTC

    Greetings surfmonkey,

    Recently I used GD and GD::Graph to do some graphing for a Web application. It originally ran under Windows and ActivePerl, then later on FreeBSD. Make sure you install all the required libraries both up and down the "chain" of modules. However, it appears to work just fine for me. Of course, with the new version of GD, you can only output PNG graphics (maybe JPG too) -- no GIFs. Too bad, I say. However, PNG seems to be supported on NS4+|6+ & IE5+, so it's not that bad of an option.

    Follow-up question: Anyone know an easy Perl way to convert PNG graphics to GIF? Or even better, a way to output GIF graphics with the new version of GD? Just curious.

    code('Perl') || die;

      ...the support for GIF images in GD fell out of the module after the technology leaders at Unisys decided to invoke the rights of their (cr@&&y) patent on compression technology.

      The entire incident was an embarrassment to the high-tech community where most of us know that public domain algorithms exist for compression that are superior to the method used in the GIF format.

      PNG graphics are just fine for web use and they do offer some more sophisticated features (such as translucent color definitions) than the GIF format anyway.

      Meanwhile the technology giants at Unisys are distracted currently from their jealous defense of their patent on obsolete technology while they team up with Microsoft to attempt to convince the world that Unix is expensive and inflexible technology.

      Their latest ad campaign extols the virtues of the much more flexible Windows system that (according to its creator) still isn't flexible enough to disassociate middleware without breaking the whole thing.

      I say that the folks who believe the newest marketing campaign by Microsoft and Unisys will get what they richly deserve. In the meantime, you could either use PNG images that you create with perl and GD, or you can try the ImageMagik modules which may still support GIF format. Or you can get an older version of GD for your system (CPAN still exposes the older GIF-inclusive version).


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://161271]
Approved by rinceWind
[karlgoethebier]: james28909: The last two are not mainstream. You have been warned ;-)
[karlgoethebier]: james28909: I don't know. Try it.
[james28909]: foreach server this bot is on, the gateway sends me a json response, which i parse out all the info with JSON, and this response has user information, i need to be able to add a user, and then update the user info when they join/leave rooms ect
[james28909]: i think im good
[james28909]: i just watched a youtube video
[karlgoethebier]: james28909: Did you look on CPAN?
[james28909]: lol

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2017-05-25 16:38 GMT
Find Nodes?
    Voting Booth?