Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Scientific Graphing, R and Perl

by Coyote (Deacon)
on Mar 17, 2003 at 19:35 UTC ( #243769=perlquestion: print w/replies, xml ) Need Help??

Coyote has asked for the wisdom of the Perl Monks concerning the following question:

This is half a rant and half a question, so bear with me. I'm trying to generate some fairly complex publication quality graphs from an XML datasource. I've been using XML::Twig to munge the data and tab delimited text files. I then take the tab deliminated files, load them into R, run some descriptive stats, and build my graphs. A quick google search reveals that there is a perl interface to R, RSPerl. In theory, I should be able to completely automate my work, however I haven't had any luck getting RSPerl to work. The installation procedure doesn't install the perl modules anywhere in @INC. I tracked down all the necessary paths, but the R module is still complaining about my environment and dying an ugly death. The RSPerl documentaion hasn't been terribly helpful and R's author's insightful selection of "R" as a name for their program has essentially rendered google useless. I'm getting a bit frustrated, so I thought I would turn to the Monestary for help.

Has any here successfully installed and used RSPerl? If so, could you give me some pointers on how to get this working? If it helps, I've tried getting this working on a fairly vannila Gentoo Linux installation running R 1.61 and perl 5.8.0 compiled from source and a RedHat 7.3 box running R 1.51 and perl 5.6.1 installed from RPM.

My second question is whether there is a better option for producing publication quality graphs from perl. I need to produce semi log scaled graphs with specific dimensions and some ideosyncratic layout conventions. Anyone have any suggestions? Thanks in advance for your help.


Replies are listed 'Best First'.
Re: Scientific Graphing, R and Perl
by toma (Vicar) on Mar 18, 2003 at 03:38 UTC
    R graphics are nice but in my experience take too much work to get to publication quality. I greatly prefer PGPLOT, which has wonderful graphics, many output devices, and an excellent perl integration. It handles log axes, polar, smith charts, etc. It works with both vector and bitmap data.

    Many of the PGPLOT output devices require installation and configuration of other packages, so the dependencies can get quite complex. The trick is to install it first with just XSERVE and then only add the other output drivers that you really need. It has a TeX output driver, so it should work easily with LaTeX.

    Another tip for installing PGPLOT is to use the default installation locations, typically /usr/local. I'm sure that it can be configured to work elsewhere, but I had trouble making all the integrations to other languages work outside of /usr/local.

    It should work perfectly the first time! - toma

Re: Scientific Graphing, R and Perl
by Coyote (Deacon) on Mar 17, 2003 at 20:56 UTC

    The group that produces RSPerl also produces a python interface for R. I was able to find a solution to my problem after searching through Omegahat's python mailing list.

    It turns out that my problem was that the R module couldn't find the R shared module. Setting the $R_HOME environment variable and adding the path for the modules to @INC solved the problem for me.

    I'm still interested in alternatives to R for this task. Thanks for everyone's help.


      In the early 1990's I made heavy use of a program called GLE written by Chris Pugmire of CSIRO. It was capable of producing very complex, (or simple), high quality publication ready graphs. I hadn't heard of Perl at that stage, but I was able to do some scripting of it using DCL on Vaxes. Doing something similar in Perl should be easy enough. At present it runs on Linux and Windows machines.

      I highly reccomend this package. I now use R all day long, and i love it dearly (though not as much as Perl). I think that GLE was a better package than R for publciation quality graphics

      Have a look here for the Linux version and over here for the Windows version. Let me know how you get on!

      Anthony Staines
Re: Scientific Graphing, R and Perl
by scain (Curate) on Mar 17, 2003 at 19:59 UTC

      Maybe coyote is wanting hardcopy-quality output. Much as I like GD, sometimes you can beat good old EPS for quality graphics.

      There is a gnuplot module for Perl, but it looks like it only wants to talk bitmap output. You could always pipe your output into gnuplot, if it's up to the task in question.

      I have also seen absurdly complex graphs generated on the fly in pic, the troff-era interpreted graphics language, but that way madness lies.

      bowling trophy thieves, die!

      I've looked into GD. In addition to the generally spartan nature of the output, I don't think GD can do log scaled graphs or EPS output. These graphs need to be included in a LaTeX document which is being submitted to a journal for publication, so GD isn't going to do it for me. Thanks for you help, though.


Re: Scientific Graphing, R and Perl
by drake50 (Pilgrim) on Mar 17, 2003 at 23:31 UTC
    For what it's worth I'm using gnuplot. Based on my experience it has a good deal of flexiblity.

    There are perl modules available for it I believe, but I'm simply outputing a csv file for the data and another file for the graph script.
    As for printing the graphs see
    I'm also interested in hearing what other people are using...
Re: Scientific Graphing, R and Perl
by mattr (Curate) on Mar 18, 2003 at 10:40 UTC
    I get a lot of related links googling for

    "R language" perl module installation


    "R language" perl graphing

Re: Scientific Graphing, R and Perl
by agent_foo (Novice) on Mar 19, 2003 at 18:51 UTC
    Perl Data Language is my favorite...;) you can munge your data with PERL and just use PDL to put togeteher your graphs or you may find PDL's data structures more intuitive and muchmuch more effiecient for operating over large data sets.... you can compile in support for jpeg, gif, png, ps (i'm pretty sure), and, what I find to be the sexiest feature, OpenGL rendering for some slick 3d can even animate your graphs and export as mpeg..... Quite an impressive package, although it is my opinion that the documentation is lacking much important detail...I haven't seen much activity with this project as of late...a pity....
      I would like to have more information about how to install Perl Data Language Module. I need to do a lot of number crunching and hence any help in this regard will be highly appreciated

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://243769]
Approved by Tomte
Front-paged by diotalevi
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: (3)
As of 2022-09-25 15:16 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (116 votes). Check out past polls.