NAME

SVG::Plot - a simple module to take a set of x,y points and plot them on a plane

SYNOPSIS

   use SVG::Plot;
   my $points = [[0,1,'http://uri/'],[2,3,'/uri/foo.png]];
   my $plot = SVG::Plot->new(
                              points => \@points,
                              debug => 0,
			      scale => 0.025,
                              max_width => 800,
                              max_height => 400,
			      point_size => 3,
			      point_style => {
			      fill => 'blue',
			      stroke => 'yellow'},
      			      line => 'follow',
                              margin => 6,
                            ); 
   # -- or --
   $plot->points($points);
   $plot->scale(4);

   print $plot->plot;

If debug is set to true then debugging information is emitted as warnings. Note that the actual margin will be half of the value set in margin, since half of it goes to each side. If max_width and/or max_height is set then scale will be reduced if necessary in order to keep the width down.

plot will croak if max_width or max_height is smaller than margin, since this is impossible.

DESCRIPTION

a very simple module which allows you to give a set of points [x co-ord, y co-ord and optional http uri]) and plot them in SVG.

$plot->points($points) where $points is a reference to an array of array references.

see the SYNOPSIS for a list of parameters you can give to the plot. (overriding the styles on the ponts; sizing a margin; setting a scale; optionally drawing a line ( line => 'follow' ) between the points in the order they are specified.

you can supply a grid in the format SVG::Plot->new( grid => { min_x => 1, min_y => 2, max_x => 15, max_y => 16 } );

or $plot->grid($grid)

this is like a viewbox that shifts the boundaries of the plot.

if it's not specified, the module works out the viewbox from the highest and lowest X and Y co-ordinates in the list of points.

NOTES

this is a very, very early draft, released so Kake can use it in OpenGuides without having non-CPAN dependencies.

for an example of what i should be able to do with this, see http://space.frot.org/rdf/tubemap.svg ... a better way of making meta-information between the lines, some kind of matrix drawing

also, i want to supply access to different plotting algorithms, not just for the cartesian plane; particularly the buckminster fuller dymaxion map; cf Geo::Dymaxion, when that gets released (http://iconocla.st/hacks/dymax/ )

to see work in progress, http://frot.org/hacks/svgplot/ ; suggestions appreciated.

BUGS

full of them i am sure; this is a very alpha release; i won't change existing the API (if it deserves the name) though.

AUTHOR

Jo Walsh  ( jo@london.pm.org )
Kate L Pugh ( kake@earth.li )