On Wed, 2005-09-28 at 08:10 +0200, Thomas Bätzler wrote:
> Hello,
>  
> Aditi Gupta <[EMAIL PROTECTED]> asked:
> >  I have a perl code that generates a sequence of values which 
> > i want to plot on y-axis against 1,2,3... on x-axis. I've 
> > read that GD::Graph could be used for it. But I've never done 
> > modular programming. Also, I don't know how to install 
> > modules from CPAN.
> > Are there any other easier methods for drawing charts using perl?
> 
> Well, you could always use an external program like gnuplot
> to generate the graph for you. That would still require that
> you understand how to use the program, though.
> 
Hello,

GD::Graph is very simple to use, just check out the CPAN documents.

If you want to use gnuplot, try the following little c shell script.

set data = $argv[1]
gnuplot <<EOF
set xlable 'x axis'
set ylable 'y label'
set title 'title'
set terminal postscript color
plot "$data" using x:y
quit
EOF

The thing with gnuplot is the vast number of options you have, this can
work out to be a good thing, you could dump in any function you like in
that script.

Another option is XMgrace, which is a nice plotting program which is
perhaps easier to use than gnuplot, after that there is matlab and other
commercial tools you could use.

I use GD as it is quick and simple.

Installing the module:

If you are on windows, making the assumption you are running Active
State perl, use the PPM to install GD::Graph

On linux just do perl -MCPAN -e 'shell'
follow the instructions and then type:
install GD::Graph and it should all be fine.


Hope that is of some use.

Dan.

> And don't be afraid to use Perl modules. Many important modules
> are already part of your Perl distribution, so you would not
> have to install them manually, anyways. As for the rest, I'm sure
> people here will be able to give you some pointers if you
> provide some details like OS and distribution used, and so on.
> 
> HTH,
> Thomas
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to