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

hi,

this is more like an advisory question(not hard core perl problem), i mean i need advice. my boss is asking of me to represent the analytic data that my perl program produces in some kind of a graphic representation . meaning there should be a graph, above the chart some table with P-values, on one side some chart and diagrams, with arrow pointers to the data on the graph and so on.

and all this has to be in *.ps (PostScript) format.

so any advice on how to do that would be nice

also postscript modules that exist are nice but i don't know how to add some diagrams or chart's to the main graph and combine and position them on the right place on the paper.

thnx addition

graphic programing with perl is a nice book but it's pretty tight on vector graphic

Replies are listed 'Best First'.
Re: perl postscript
by Corion (Patriarch) on Jun 30, 2008 at 08:22 UTC

    I use SVG::Graph::TT and convert the resulting SVG using Inkscape to EPS or PS (or, in my case, PDF) files. The inkscape binary has a command line mode that can be used to do mass conversion of files.

Re: perl postscript
by moritz (Cardinal) on Jun 30, 2008 at 08:51 UTC
    There are basically two approaches: The first one is to learn postscript, and then use perl to generate the postscript files, presumably with a template system.

    The other approach is to to ignore that you have to work with postscript, and instead focus on arbitrary vector graphics, because most of those can be converted to postscript in the end.

    For example gnuplot can produce vector graphics, and incidentally postscript is one of its output formats.

    For combining multiple graphics into one, consider using ghostscript, it's the postscript swiss-army chain saw.

Re: perl postscript
by ambrus (Abbot) on Jun 30, 2008 at 08:49 UTC

      I second the use of gnuplot. I used it quite a bit in some coursework. It can be a little tricky to start out with, but there are plenty of sources to help you learn how to use it.

      One thing I particularly like about it is that it's command-line driven, so you can play with the parameters and see the results. Then, when you get it *just* the way you like it before starting any coding.

      ...roboticus
Re: perl postscript
by zentara (Cardinal) on Jun 30, 2008 at 15:11 UTC
    As usual, I will throw in using a Canvas( Tk, Goo, etc). They allow you full freedom in drawing and will output postscript. Goo will allow transparencies, and svg output. A simple Tk example:
    #!/usr/bin/perl -w use strict; use Tk; my($o, $s) = (250, 20); my($pi, $x, $y) = (3.1415926, 0); my $mw = MainWindow->new; my $c = $mw->Canvas(-width => 500, -height => 500, -bg => 'white', )->pack; # make minimal axis set $c->createLine(50, 250, 450, 250); $c->createText(10, 250, -fill => 'blue', -text => 'X'); $c->createLine(250, 50, 250, 450); $c->createText(250, 10, -fill => 'blue', -text => 'Y'); # add some data for ($x = -(3*$pi); $x <= +(3*$pi); $x += 0.1) { $y = sin($x); $c->createText( $x*$s+$o, $y*$s+$o, -fill => 'red', -text => ':'); $y = cos($x); $c->createText( $x*$s+$o, $y*$s+$o, -fill => 'green', -text => '|' +); } $mw->Button( -text => "Save Postscript", -command => sub { $c->update; my @capture=(); my ($x0,$y0,$x1,$y1)=$c->bbox('all'); @capture=('-x'=>$x0,'-y'=>$y0,-height=>$y1-$y0,-width=>$x1-$x +0); $c -> postscript(-colormode=>'color', -file=>$0.'.ps', -rotate=>0, @capture); print "saved\n"; } )->pack; MainLoop;

    I'm not really a human, but I play one on earth CandyGram for Mongo