Graphics::Libplot - Perl extension for libplot plotting library
use Graphics::Libplot ':All';
This module lets you create plots by calling the routines in the libplot library. The libplot library is included in the plotutils package. Wrappers for each published C function are present. So the section of the plotutils info pages on programming in C should be your main reference. There are a few possible confusions, which are noted below.
Some of the C routines require character constants rather than strings. When using the equivalent perl function, you must wrap the character with the 'ord' function. For instance, alabel(ord 'c', ord 'c', "some text"); , will write some centered text.
None of the libplot functions is exported by default. If you do not import any functions you must prepend the module name to each function. To call the openpl() function you would give,
Graphics::Libplot::openpl();
However, if you include the library with
use Graphics::Libplot ':All'
then all of the functions will be exported, and you do not need to prepend the module name. In this case you need to be careful because there are many function names which may collide with others in your program.
On the other hand you can use one of
use Graphics::Libplot ':INTEGERLOW' use Graphics::Libplot ':FLOATLOW'
to get just integer or just floating point plotting.
Be aware that the interface is still under development so more names will be added, and your scripts may need to be changed.
There are additional examples included in the source distribution. This example draws a spiraling box pattern.
use Graphics::Libplot ':ALL'; $SIZE=100; parampl ("BITMAPSIZE", "700x700"); $handle = newpl("X", stdin, stdout, stderr); # open xwindow display selectpl($handle); openpl(); fspace(-$SIZE,-$SIZE, $SIZE, $SIZE); # specify user coord system pencolorname ("blue"); fontname("HersheySerif"); $s = 10; $f = 10; $sf = 1- .0012; for($i=1;$i<3000;$i++){ fscale($sf,$sf); fbox(60+$s*sin($i/$f), 60+$s*sin($i/$f), 75-$s*cos($i/$f), 75-$s*cos($i/$f)); frotate(1); } closepl(); selectpl(0); deletepl($handle);
Substituting "ps" for "X" in the above example produces postscript on the standard output stream.
John Lapeyre <lapeyre@physics.arizona.edu> wrote this perl interface.
The libplot C library is developed by Robert Maier.
libplot-perl is copyrighted by John Lapeyre and may be distributed only under the terms of either the Gnu General Public License, or of the perl Artistic License.
perl(1).
To install Graphics::Libplot, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Graphics::Libplot
CPAN shell
perl -MCPAN -e shell install Graphics::Libplot
For more information on module installation, please visit the detailed CPAN module installation guide.