There are no proper bindings for the Perl language delivered with the PLplot sources. However, a PLplot interface has been added to the Perl Data Language (PDL) since version 2.4.0. If the PLplot library is installed in the system, it is automatically detected by the PDL configuration script, such that PLplot support for PDL should work out of the box. For further information see the PDL homepage.
The PDL PLplot interface (PDL::Graphics::PLplot) can interact with PLplot in two ways: (1) A low level mapping one to one mapping of perl functions to PLplot API functions and (2) A high level object oriented wrapper that simplifies generating 2D plots. The PLplot source distribution contains multiple examples of how to use the low level interface (see examples/perl). A key thing to note is that, due to the architecture of PDL, all the array arguments to a function come first, followed by the scalars. This means that the argument order for some of the functions in the PLplot API is different when called from PDL.
Here is an usage example comparing the low level and the object oriented interfaces to PLplot.
use PDL; use PDL::Graphics::PLplot; my $x = pdl (0..5); my $y = $x ** 2; # low level interface plsdev ("xwin"); plinit (); plcol0 (1); plenv (-0.5, 5.5, -1, 26, 0, 0); plline ($x, $y); plend (); # OO interface my $pl = PDL::Graphics::PLplot->new (DEV => "xwin", ); $pl->xyplot($x, $y, TITLE => 'X vs. Y'); $pl->close;
There is also a Perl PLplot interface on CPAN which is not dependent on PDL. The Perl module is called Graphics::PLplot and is appropriate for small data arrays. The API is very similar to the C API except that if the number of elements in an array is required by the C function the perl interface calculates it automatically. Also, return values are returned and not supplied as arguments. Here is the PDL example above translated to Graphics::PLplot:
use Graphics::PLplot qw/ :all /; @x = (0..5); @y = map {$_ * $_} @x; plsdev ("xwin"); plinit (); plcol0 (1); plenv (-0.5, 5.5, -1, 26, 0, 0); plline (\@x, \@y); plend ();