[fpc-pascal]ASCII plotting

Alan Mead cubrewer at yahoo.com
Tue Jul 29 18:54:53 CEST 2003


I would like to include some simple "ascii plots" in my textual
output files, like :

10.0|  **
    | *  *
    | *  *
    |*    *
    |*    *
    *      *
    *       *
    *        *
    *         *
    *         *
    *          *
0.00|-----------*-*-
     -3.5      3.50

I've coded something simple ... three times now... and I now realize
how complex this can get.  Lot's of isues with changing scales,
optimizing the ouptut for very granular rows and columns, syncing the
plot with the labels, choosing "good" labels, etc.  For example, I
found that I need to draw a "line" between the points otherwise the
vertical line segments get lost:

10.0|  **
    | *  *
    |     
    |*    *
    |      
    |      *
    |       *
    |        *
    |         *
    |          
    *          *
0.00|-----------*-*-
     -3.5      3.50

But now I find that if I choose too many X values then the line
segment drawing tends to make the make the drawing "fat", especially
at the tails:

10.0|  **
    | *  *
    | *  *
    |*    *
    |*     *
    |*     *
    |*     *
    |*      *
    **      *
    **        **
    **         ***
0.00|-----------***-
     -3.5      3.50

Because I'm plotting discrete functions, changing the number of X
values requires a complicated interpolation procedure...

So, does anyone, by chance, already have a unit for doing this?

-Alan Mead

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com




More information about the fpc-pascal mailing list