Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

making a scientific chart

by baxy77bax (Chaplain)
on Dec 30, 2008 at 09:33 UTC ( #733210=perlquestion: print w/ replies, xml ) Need Help??
baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:


well after a long perlmonks, cpan and google searching, for a suitable module , script and a method. i came up with nothing, nada, zero, 0. what am i looking for is the way to create a high quality line, bar chart in PS, pdf, eps, and png format that looks something like this : mixed chart

the really cool thing that looks it can do most of the things i need is gnuplot module but to get this module working on windows, that is just to pipe it to gnuplot is a miracle (i keep getting tons of errors like : Invalid Parameter - 90,Error in tempdir() using \tmp\XXXXXXXXXX: Parent directory (\tmp) does not exist at C:/Perl/site/lib/Chart/ line 1330, .... and many more -- so i just gave up on it, if i can't make it work in a reasonable time i can't expect an average joe to sit at his computer for days trying to make something work, that he is going to use couple of times a year).

so any advice would bi useful. even the one telling me to give up

some of modules i've looked at :


PostScript::Graph::XY -- the whole family

GD::Graph -- family

Chart -- family

... and many more i cant even remember any more

Comment on making a scientific chart
Re: making a scientific chart
by imrags (Monk) on Dec 30, 2008 at 10:40 UTC
    Have you tried Charts , it mentions usage of DBD::Chart
    From what I've read, it used Database and requires quite a few modules
    I have not tried them but I hope it helps.
Re: making a scientific chart
by almut (Canon) on Dec 30, 2008 at 12:43 UTC

    There's also R, which can produce a number of nifty diagrams — see Graphical procedures for an introduction (not exhaustive, as much functionality comes via individual packages / object types).  Its primary focus is on statistics, but it provides a number of rather generic plotting facilities which may be used for many other purposes as well. It supports various output formats (Device drivers), allows for custom arrangement of multiple figures, has low-level drawing commands, etc.

    Statistics::R is a Perl wrapper around the R interpreter (though I'm not sure how well it works under Windows...).

Re: making a scientific chart
by zentara (Archbishop) on Dec 30, 2008 at 13:39 UTC
    It might take a bit of work, but look at Goo::Canvas Graphing demo. The Goo modules comes pre-built and works fine on Windows with Camelbox Perl , which installs easily from my limited experience on Vista Basic. Goo is based on Cairo ( a postscript style drawing language, which you might use on it's own ) and Goo extends it to persistent items, transparencies, rotated text, etc.

    I'm not really a human, but I play one on earth Remember How Lucky You Are
Re: making a scientific chart
by scorpio17 (Monsignor) on Dec 30, 2008 at 14:23 UTC
    The PDL module family includes access to the PGPLOT library, which can do MATLAB-like 2D and 3D plots.
Re: making a scientific chart
by planetscape (Canon) on Dec 30, 2008 at 15:43 UTC
      Instead of using a CPAN module why not try simply creating a file and then call gnuplot (see the gnuplot demo gallery).. Some tested example code:
      use strict; open( my $fout, ">myplot.gpt" ) or die( "Problem: $!" ); print( $fout <<'EOF' ); reset set terminal png size 320,160 medium set output 'myplot.png' set title "Test Plot" set xrange [0:5] set yrange [0:100] plot [0:5] "-" using 1:2 title "Distance" with lines 1.0 20 2.0 40 3.0 40 4.0 80 end EOF close( $fout ); my $result = `gnuplot myplot.gpt`; print( $result ) if ( $result );

      Update: added close() to ensure command file was closed before being fed to gnuplot

Re: making a scientific chart
by Anonymous Monk on Dec 30, 2008 at 18:14 UTC
Re: making a scientific chart
by tinita (Parson) on Dec 31, 2008 at 11:41 UTC
    I can recommend ChartDirector:
    It's free for non-commercial use, and you can create very nice-looking graphs with it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://733210]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2014-08-01 11:12 GMT
Find Nodes?
    Voting Booth?

    Who would be the most fun to work for?

    Results (6 votes), past polls