source: project/wiki/eggref/5/slib-charplot @ 38674

Last change on this file since 38674 was 38674, checked in by Kon Lovett, 9 months ago

rel 1.1.0

File size: 5.1 KB
Line 
1[[tags: egg]]
2
3== slib-charplot
4
5[[toc:]]
6
7
8=== Description
9
10A port of the [[http://people.csail.mit.edu/jaffer/SLIB|SLIB]] character
11plotting library. For SLIB documentation see
12[[http://people.csail.mit.edu/jaffer/slib/Character-Plotting.html#Character-Plotting|charplot]].
13
14=== Documentation
15
16'''Note''' that the SLIB documentation describes {{charplot:dimensions}}.
17This, and other plot defining variables, are ''not'' exported here. Rather
18{{parameter}}s are provided.
19
20===== Usage
21
22<enscript language=scheme>
23(import slib-charplot)
24</enscript>
25
26===== plot-dimensions
27
28<procedure>(plot-dimensions [DIMS]) -> (or boolean (list exact-integer exact-integer))</procedure>
29
30A list of the maximum height (number of lines) and maximum width (number of
31columns) for the graph, its scales, and labels.
32
33The default value uses the output-port-height and output-port-width of
34current-output-port at plot time.
35
36; {{DIMS}} : {{(or #f (list exact-integer exact-integer))}} ; (Height-rows Width-columns), default {{#f}}
37
38The left-margin effects the width consumed. The effective minimum dimensions
39are {{(4 (+ 5 (plot-left-margin)))}}.
40
41Use this {{parameter}} instead of {{charplot:dimensions}}.
42
43===== plot-left-margin
44
45<procedure>(plot-left-margin [WID]) -> exact-integer</procedure>
46
47; {{WID}} : {{(or #f exact-integer)}} ; Width-columns, initial {{12}}, default {{2}}
48
49{{2}} is the the minimum value.
50
51Use this {{parameter}} instead of {{charplot:left-margin}}.
52
53===== xborder-char
54===== yborder-char
55===== xaxis-char
56===== yaxis-char
57===== xtick-char
58===== bar-char
59
60<procedure>(xborder-char [CHAR]) -> char</procedure>
61<procedure>(yborder-char [CHAR]) -> char</procedure>
62<procedure>(xaxis-char [CHAR]) -> char</procedure>
63<procedure>(yaxis-char [CHAR]) -> char</procedure>
64<procedure>(xtick-char [CHAR]) -> char</procedure>
65<procedure>(bar-char [CHAR]) -> char</procedure>
66
67Use these {{parameter}}s instead of {{char:xborder}}, {{char:yborder}}, {{char:xaxis}},
68{{char:yaxis}}, {{char:xtick}} & {{char:bar}}.
69
70===== curves-chars
71
72<procedure>(curves-chars [CHARS]) -> exact-integer</procedure>
73
74; {{CHARS}} : {{(or #f string)}} ; characters to use for the plot curve, {{#f}} uses the default set.
75
76Use this {{parameter}} instead of {{char:curves}}.
77
78===== plot
79
80<procedure>(plot COORDS [X-LABEL [Y-LABEL [HISTOGRAM?]]])</procedure>
81
82{{COORDS}} is an array, list or vector of coordinates, lists of x and y coordinates.
83{{X-LABEL}} and {{Y-LABEL}} are strings with which to label the x and y axes.
84
85; {{COORDS}} : {{(or array list vector)}} ; coordinate data elements
86; {{X-LABEL}} : {{string}} ; x axis label, default {{""}}
87; {{Y-LABEL}} : {{string}} ; y axis label, default {{""}}
88; {{HISTOGRAM?}} : {{boolean}} ; line or filled graph, default {{#f}}
89
90The elements of a {{list}} are of the form {{(X Y1 ... Yn)}}, where {{(< 0
91n)}}. Other accepted forms are: {{(X . Y)}} & {{(X (Y1 ... Yn))}}, which are
92interpreted as {{(X Y)}} & {{(X Y1 ... Yn)}}, respectively.
93
94The elements of a 1-dim {{array}} or {{vector}} are of type {{Y}} or {{(Y1 ...
95Yn))}}. The missing {{X}} value is generated from {{[0 .. c-1]}}, where {{c}}
96is the cardinality of the {{array}} or {{vector}}. The generated data is then
97{{(X Y ...)}}.
98
99The elements of a 2-dim {{array}} are interpreted as {{(X Y ...)}}.
100
101The following {{COORDS}} produce the same plot:
102* {{(list->array 2 '#() '((0 12 21) (1 21 12)))}}
103* {{#((12 21) (21 12))}}
104* {{((0 12 21) (1 21 12))}}
105
106<procedure>(plot FUNC [X1 [X2 [NPTS]]])</procedure>
107
108Plots the function of the single-argument {{FUNC}} over the range {{X1}} to
109{{X2}}. If the optional integer argument {{NPTS}} is supplied, it specifies
110the number of points to evaluate func at.
111
112; {{FUNC}}  : {{(number -> float)}} ; function to plot
113; {{X1}} : {{number}} ; plot range start, default {{0}}
114; {{X2}} : {{number}} ; plot range end, default {{1}}
115; {{NPTS}} : {{exact-integer}} ; number of points to evaluate {{FUNC}}, default {{64}}
116
117===== histograph
118
119<procedure>(histograph DATA LABEL)</procedure>
120
121Creates and displays a histogram of the numerical values contained in vector
122or list {{DATA}}. {{LABEL}} is a string.
123
124; {{DATA}} : {{(or list vector)}} ; elements are {{number}}
125; {{LABEL}} : {{string}} ; plot label
126
127
128=== Author
129
130Aubrey Jaffer
131
132
133=== Maintainer
134
135[[/users/kon-lovett|Kon Lovett]]
136
137
138=== Requirements
139
140[[srfi-63]]
141
142
143=== Version history
144
145; 1.1.0 : {{plot}} labels & range optional.
146; 1.0.3 : {{plot}} accepts a {{SRFI-63}} {{array}}.
147; 1.0.0 : C5 release.
148
149
150=== License
151
152Copyright (C) 1992, 1993, 2001, 2003 Aubrey Jaffer
153
154Permission to copy this software, to modify it, to redistribute it,
155to distribute modified versions, and to use it for any purpose is
156granted, subject to the following restrictions and understandings.
157
1581.  Any copy made of this software must include this copyright notice
159in full.
160
1612.  I have made no warranty or representation that the operation of
162this software will be error-free, and I am under no obligation to
163provide any services, by way of maintenance, update, or otherwise.
164
1653.  In conjunction with products arising from the use of this
166material, there shall be no use of my name in any advertising,
167promotional, or sales literature without prior written consent in
168each case.
Note: See TracBrowser for help on using the repository browser.