|
|
1.1 root 1: .TH GRAP 1
2: .CT 1 writing_troff graphics numbers
3: .SH NAME
4: grap \(mi pic preprocessor for drawing graphs
5: .SH SYNOPSIS
6: .B grap
7: [
8: .I file ...
9: ]
10: .SH DESCRIPTION
11: .I Grap
12: is a
13: .IR pic (1)
14: preprocessor for drawing graphs on a typesetter.
15: Graphs are surrounded by the
16: .I troff
17: `commands'
18: .B \&.G1
19: and
20: .BR \&.G2 .
21: Data are scaled and plotted,
22: with tick marks supplied automatically.
23: Commands exist to modify the frame,
24: add labels, override the default ticks,
25: change the plotting style,
26: define coordinate ranges and transformations,
27: and include data from files.
28: In addition,
29: .I grap
30: provides the same loops, conditionals and macro processing that
31: .I pic
32: does.
33: .PP
34: .BI frame
35: .B ht
36: .I e
37: .B wid
38: .I e
39: .B top
40: .B dotted
41: .IR ... :
42: Set the frame around the graph to specified
43: .B ht
44: and
45: .BR wid ;
46: default is 2 by 3 (inches).
47: The line
48: .I styles
49: .RB ( dotted ,
50: .BR dashed ,
51: .BR invis ,
52: .BR solid
53: (default))
54: of the
55: .I sides
56: .RB ( top ,
57: .BR bot ,
58: .BR left ,
59: .BR right )
60: of the frame can be set
61: independently.
62: .PP
63: .B label
64: .I side
65: .B \&"a label"
66: .B \&"as a set of strings"
67: .IR adjust :
68: Place label on specified side; default side is bottom.
69: .I adjust
70: is
71: .B up
72: (or
73: .B down
74: .B left
75: .BR right )
76: .I expr
77: to shift default position;
78: .B width
79: .I expr
80: sets the width explicitly.
81: .PP
82: .BI ticks
83: .I side
84: .B in
85: .B at
86: .IR "optname expr, expr, ..." :
87: Put ticks on
88: .I side
89: at
90: .I "expr, ...,
91: and label with
92: .I \&"expr".
93: If any
94: .I expr
95: is followed by "...", label tick with "...",
96: and turn off all automatic labels.
97: If "..." contains
98: .BR %f 's,
99: they will be interpreted as
100: .B printf
101: formatting instructions for the tick value.
102: Ticks point
103: .B in
104: or
105: .B out
106: (default out).
107: Tick iterator: instead of
108: .B at
109: .I \&...,
110: use
111: .BI from
112: .I expr
113: .B to
114: .I expr
115: .B by
116: .I "op expr
117: where
118: .I op
119: is optionally
120: .B +-*/
121: for additive or multiplicative steps.
122: .B by
123: can be omitted, to give steps of size 1.
124: If no ticks are requested, they are supplied automatically;
125: suppress this with
126: .B ticks
127: .BR off .
128: Automatic ticks normally
129: leave a margin of 7% on each side; set this to anything by
130: .B margin
131: .B =
132: .I expr.
133: .PP
134: .B grid
135: .I "side linedesc"
136: .B at
137: .IR "optname expr, expr, ..." :
138: Draw grids perpendicular to
139: .I side
140: in style
141: .I linedesc
142: at
143: .I "expr, ....\&
144: Iterators and labels work as with ticks.
145: .PP
146: .B coord
147: .I optname
148: .B x
149: .I "min, max"
150: .B y
151: .I "min, max"
152: .B "log x
153: .BR " log y" :
154: Set range of coords and optional log scaling on either or both.
155: This overrides computation of data range.
156: Default value of
157: .I optname
158: is current coordinate system
159: (each
160: .B coord
161: defines a new coordinate system).
162: .PP
163: .B plot
164: .I \&"str"
165: .B at
166: .IR point ;
167: .B
168: .I \&"str"
169: .B at
170: .IR point :
171: Put
172: .I str
173: at
174: .I point.
175: Text position can be qualified with
176: .BR rjust ,
177: .BR ljust ,
178: .BR above ,
179: .BR below
180: after "...".
181: .PP
182: .B line
183: .B from
184: .I point
185: .B to
186: .IR "point linedesc" :
187: Draw line from here to there.
188: .B arrow
189: works in place of
190: .BR line .
191: .PP
192: .B next
193: .I optname
194: .B at
195: .IR "point linedesc" :
196: Continue plot of data in
197: .I optname to
198: .IR point ;
199: default is current.
200: .PP
201: .BI draw
202: .IR "optname linedesc ..." :
203: Set mode for
204: .BR next :
205: use this style from now on,
206: and plot "..." at each point (if given).
207: .PP
208: .BI new
209: .IR "optname linedesc ..." :
210: Set mode for
211: .BR next ,
212: but disconnect from previous.
213: .PP
214: A list of numbers
215: .I "x y1 y2 y3 ...
216: is treated as
217: .B plot
218: .B bullet
219: .B at
220: .IR x,y1 ;
221: .B plot
222: .B bullet
223: .B at
224: .IR x,y2 ;
225: etc., or as
226: .B next
227: .B at
228: .I x,y1
229: etc., if
230: .B draw
231: is specified.
232: Abscissae of 1,2,3,... are provided if there is only one input number per line.
233: .PP
234: A
235: point
236: .I "optname expr, expr
237: maps the point to the named coordinate system.
238: A
239: .I linedesc
240: is one of
241: .B dot
242: .B dash
243: .B invis
244: .B solid
245: optionally followed by an expression.
246: .PP
247: .BI define
248: .I name
249: .BI { whatever } :
250: Define a macro.
251: There are macros already defined for standard plotting
252: symbols like
253: .BR bullet ,
254: .BR circle ,
255: .BR star ,
256: .BR plus ,
257: etc., in
258: .FR /usr/lib/grap.defines ,
259: which is included if it exists.
260: .PP
261: .I var
262: .B =
263: .IR expr :
264: Evaluate an expression.
265: Operators are
266: .B=
267: .B +
268: .B -
269: .B *
270: and
271: .B / .
272: Functions are
273: .B log
274: and
275: .B exp
276: (both base 10),
277: .BR sin ,
278: .BR cos ,
279: .BR sqrt ;
280: .B rand
281: returns random number on [0,1);
282: .BI max( e , e ) ,
283: .BI min( e , e ) ,
284: .BI int( e ) .
285: .PP
286: .B print
287: .IR expr ;
288: .B print
289: \f5"\f2...\f5"\f1:
290: As a debugging aid, print
291: .I expr or
292: .I string
293: on the standard error.
294: .PP
295: .B copy
296: \f5"\fIfilename\f5"\fR:
297: Include this file right here.
298: .PP
299: .B copy
300: .B thru
301: .IR macro :
302: Pass rest of input (until
303: .BR \&.G2 )
304: through
305: .IR macro ,
306: treating each field (non-blank, or "...") as an argument.
307: .I macro
308: can be the name of a macro previously defined,
309: or the body of one in place, like
310: .BR "/plot $1 at $2,$3/" .
311: .PP
312: .B copy
313: .B thru
314: .I macro
315: .B until
316: \f5"\fIstring\f5"\fR":
317: Stop copy when input is
318: .I string
319: (left-justified).
320: .PP
321: .BI pic
322: .IR "remainder of line" :
323: Copy to output with leading blanks removed.
324: .PP
325: .BI graph
326: .IR "Name pic-position" :
327: Start a new frame, place it at specified position,
328: e.g.,
329: .B graph
330: .B Thing2
331: .BR "with .sw at Thing1.se + (0.1,0)" .
332: .I Name
333: must be capitalized to keep
334: .I pic
335: happy.
336: .PP
337: .BI \&. "anything at beginning of
338: .IR line :
339: Copied verbatim.
340: .PP
341: .B sh
342: .BI % anything
343: .BR % :
344: Pass everything between the
345: .BR % 's
346: to the shell;
347: as with macros,
348: .B %
349: may be any character and
350: .I anything
351: may include newlines.
352: .PP
353: .B #
354: .IR anything :
355: A comment, which is discarded.
356: .PP
357: Order is mostly irrelevant; no category is mandatory.
358: Any arguments on the
359: .B \&.G1
360: line are placed on the generated
361: .B \&.PS
362: line for
363: .I pic.
364: .SH EXAMPLES
365: .EX
366: .ps -1
367: .vs -1
368: \&.G1
369: frame ht 1 top invis right invis
370: coord x 0, 10 y 1, 3 log y
371: ticks left in at 1 "bottommost tick", 2,3 "top tick"
372: ticks bot in from 0 to 10 by 2
373: label bot "silly graph"
374: label left "left side label" "here"
375: grid left dashed at 2.5
376: copy thru / circle at $1,$2 /
377: 1 1
378: 2 1.5
379: 3 2
380: 4 1.5
381: 10 3
382: \&.G2
383: .G1
384: frame ht 1 top invis right invis
385: coord x 0, 10 y 1, 3 log y
386: ticks left in at 1 "bottommost tick", 2,3 "top tick"
387: ticks bot in from 0 to 10 by 2
388: label bot "silly graph"
389: label left "left side label" "here"
390: grid left dashed at 2.5
391: copy thru / circle at $1,$2 /
392: 1 1
393: 2 1.5
394: 3 2
395: 4 1.5
396: 10 3
397: .G2
398: .ps
399: .vs
400: .EE
401: .SH FILES
402: .TF /usr/lib/grap.defines
403: .TP
404: .F /usr/lib/grap.defines
405: definitions of standard plotting characters, e.g., bullet
406: .SH "SEE ALSO"
407: .IR graph (1),
408: .IR pic (1),
409: .IR troff (1),
410: .IR plot (3)
411: .br
412: J. L. Bentley and B. W. Kernighan,
413: `GRAP\(emA Language for Typesetting Graphs',
414: this manual, Volume\ 2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.