ScatterPlot - Perl extension for drawing ASCII scatter plots
This module will draw a quick and easy ASCII scatter plot. It has only two functions, new() and draw(). new() takes no arguments and creates a new ScatterPlot object. draw() can be called with no arguments to draw a sample test plot. You can call draw like this:
where $xy_points is a reference to an array of (x,y) pairs. See the file ScatterPlot.pl for an example. The full call to draw is:
draw($xy_points, $x_size, $y_size, $x_label, $y_label, $char, $type);
where $xy_points is a reference to an array of (x,y) pairs, $x_size is an integer describing the width of the plot in characters, $y_size is an integer describing the height of the plot in characters, $x_label is a string for the horizontal axis label, $y_label is a string for the vertical axis lable, $char is the plot character, and $type is either 'text', 'html', or 'HTML'. If you are using CGI or sending the plot output to a web page, then use $type='html' or $type='HTML'.
The method draw() will automatically scale the plot to fit your data and draw the axes labels accordingly. The size of the output text will be $y_size lines of text, each of which is $x_size long in characters (plus line terminator). In text mode the plot begins with "\n" and ends with "\n", while in html mode the plot begins with "<pre>" and ends with "<\pre>".
The example file ScatterPlot.pl contains an example of how to use the ScatterPlot module.
Les Hall, <email@example.com>
Copyright 2007 by Les Hall
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.