RE: how to make charts using GD





On Wed, 2005-09-28 at 08:10 +0200, Thomas Bätzler wrote:
> Hello,
>
> Aditi Gupta <aditi9783@xxxxxxxxx> 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
>


.



Relevant Pages

  • Re: attempt to build 64 bit on Solaris fails
    ... > libraries needed to link with a 64-bit Tk. ... We were running a 32-bit version of Perl ... > Each section below is a summary of the commands used to install it. ...
    (comp.lang.perl.tk)
  • Re: attempt to build 64 bit on Solaris fails
    ... libraries needed to link with a 64-bit Tk. ... We were running a 32-bit version of Perl ... Each section below is a summary of the commands used to install it. ...
    (comp.lang.perl.tk)
  • Perl on Linux and SQL Server 2000 on Windows
    ... There was a time when I did a lot of searching on ways to use Perl ... sitting on Linux to connect SQL Server 2000 sitting on Windows. ... cpan> install DBI ... Install FreeTDS ...
    (comp.os.linux.misc)
  • RE: Please Help !!! Unable to install DBD-Oracle ( I am using perl 5.6 on solaris 8)
    ... Ron, I could be way off here, but the OP mayalready have Perl ... think the original issue was that he tried to use *PPM* to install ... I don't have any Solaris ... you are not the intended recipient, please notify the sender at Wipro ...
    (perl.dbi.users)
  • Re: Installing DBD::File via CPAN
    ... Do you use 'UNINST=1' in the build options for CPAN? ... >> Did you build Perl from source, or install via a RPM or binary distro? ... >>> sender of the delivery error by replying to this message, or notify us ...
    (perl.dbi.users)