NAME
SVG::Plot - a simple module to take a set of x,y points and plot them on a plane
ABSTRACT
use SVG::Plot;
my $points = [[0,1,'http://uri/'],[2,3,'/uri/foo.png]];
my $plot = SVG::Plot->(
points => \@points,
scale => 0.025,
point_size => 3,
point_style => {
fill => 'blue',
stroke => 'yellow'},
line => 'follow',
margin => 6,
);
# -- or --
$plot->points($points);
$plot->scale(4);
print $plot->plot;
SYNOPSIS
use SVG::Plot;
my $points = [[0,1,'http://uri/'],[2,3,'/uri/foo.png]];
my $plot = SVG::Plot->(
points => \@points,
scale => 0.025,
point_size => 3,
point_style => {
fill => 'blue',
stroke => 'yellow'},
line => 'follow',
margin => 6,
);
# -- or --
$plot->points($points);
$plot->scale(4);
print $plot->plot;
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 )