1. charplot
    1. Introduction
    2. Requirements
    3. Documentation
      1. charplot:dimensions
      2. charplot-width, charplot-height
      3. plot
      4. histograph
    4. Authors
    5. License
    6. Version history

charplot

Introduction

An extension for character-mode plotting (originally from SLIB).

Requirements

array-lib

Documentation

charplot:dimensions

 [variable] charplot:dimensions

A list of the maximum height (number of lines) and maximum width (number of columns) for the graph, its scales, and labels.

The default value for charplot:dimensions is the output-port-height and output-port-width of current-output-port.

charplot-width, charplot-height

 [parameter] charplot-width
 [parameter] charplot-height

The default width and height of the plot. Defaults to 79 and 24, respectively.

plot

 [proedure] (plot coords x-label y-label)

coords is a list or vector of coordinates, lists of x and y coordinates. x-label and y-label are strings with which to label the x and y axes.

Example:

    (set! charplot:dimensions '(20 55))
    (define (make-points n)
      (if (zero? n)
          '()
          (cons (list (/ n 6) (sin (/ n 6))) (make-points (sub1 n)))))
    (plot (make-points 40) "x" "Sin(x)")
    
      Sin(x)   _________________________________________
             1|-       ****                             |
              |      **    **                           |
          0.75|-    *        *                          |
              |    *          *                         |
           0.5|-  *            *                        |
              |  *                                     *|
          0.25|-                *                     * |
              | *                *                      |
             0|-------------------*------------------*--|
              |                                     *   |
         -0.25|-                   *               *    |
              |                     *             *     |
          -0.5|-                     *                  |
              |                       *          *      |
         -0.75|-                       *        *       |
              |                         **    **        |
            -1|-                          ****          |
              |:_____._____:_____._____:_____._____:____|
         x                 2           4           6
 [procedure] (plot func x1 x2)
 [procedure] (plot func x1 x2 npts)

Plots the function of one argument FUNC over the range X1 to X2. If the optional integer argument NPTS is supplied, it specifies the number of points to evaluate FUNC at.

    (plot sin 0 (* 2 3.14))
               _________________________________________
             1|-:       ****                            |
              | :     **    **                          |
          0.75|-:    *        *                         |
              | :   *          *                        |
           0.5|-:  **          **                       |
              | : *             *                       |
          0.25|-:**              **                     |
              | :*                *                     |
             0|-*------------------*--------------------|
              | :                  *                 *  |
         -0.25|-:                   **              **  |
              | :                    *             *    |
          -0.5|-:                     *           **    |
              | :                      *          *     |
         -0.75|-:                       *       **      |
              | :                        **    **       |
            -1|-:                          ****         |
              |_:_____._____:_____._____:_____._____:___|
                     0           2           4           6

histograph

 [procedure] (histograph data label)

Creates and displays a histogram of the numerical values contained in vector or list DATA

    (define (random:normal)
      (/ (- (random 2000) 1000) 1000) )
    (histograph (do ((idx 99 (+ -1 idx))
                     (lst '() (cons (* .02 (random:normal)) lst)))
                    ((negative? idx) lst))
                "normal")
               _________________________________________
             8|-                :    I                  |
              |                 :    I                  |
             7|-           I  I :    I                  |
              |            I  I :    I                  |
             6|-          III I :I   I                  |
              |           III I :I   I                  |
             5|-          IIIIIIIIII I                  |
              |           IIIIIIIIII I                  |
             4|-          IIIIIIIIIIII                  |
              |           IIIIIIIIIIII                  |
             3|-I    I I  IIIIIIIIIIII  II     I        |
              | I    I I  IIIIIIIIIIII  II     I        |
             2|-I    I I IIIIIIIIIIIIIIIII     I        |
              | I    I I IIIIIIIIIIIIIIIII     I        |
             1|-II I I IIIIIIIIIIIIIIIIIIIII   I I I    |
              | II I I IIIIIIIIIIIIIIIIIIIII   I I I    |
             0|-IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII----|
              |__.____:____.____:____.____:____.____:___|
      normal        -0.025      0       0.025      0.05

Authors

Aubrey Jaffer, CHICKEN port by felix winkelmann

License

Copyright (C) 1992, 1993, 2001, 2003 Aubrey Jaffer

Permission to copy this software, to modify it, to redistribute it, to distribute modified versions, and to use it for any purpose is granted, subject to the following restrictions and understandings.

1. Any copy made of this software must include this copyright notice in full.

2. I have made no warranty or representation that the operation of this software will be error-free, and I am under no obligation to provide any services, by way of maintenance, update, or otherwise.

3. In conjunction with products arising from the use of this material, there shall be no use of my name in any advertising, promotional, or sales literature without prior written consent in each case.

Version history

0.1
first release