1grap is a pic preprocessor for drawing graphs.
2
3 grap [files] | pic | ... (mrkos!/usr/bin so far)
4
5.G1
6frame ht e wid e top dotted ...
7 sets frame around graph to specified ht and wid;
8 default ht 3, wid 2
9 default mode applies to all four sides;
10 you can set top, bot, left or right
11 to dotted, dashed, invis, solid independently
12label side "a label" "as a set of strings" adj
13 one line per label, on the four sides.
14 default side is bot
15 adj is up|down|left|right expr, to shift default position
16ticks side inout at optname expr, expr, ...
17 put ticks on side at expr, ..., and label with "expr".
18 if any expr followed by "...", label tick with "...",
19 and turn off all automatic labels.
20 if "..." contains %f's, they will be interpreted as printf
21 formatting instructions for the tick value.
22 ticks point in or out according to inout (default out)
23 tick iterator: instead of at ..., use from expr to expr by o expr
24 where o is optionally +-*/ for additive or multiplicative steps.
25 "by" can be omitted, to give steps of size 1.
26 if no ticks requested, they are supplied automatically;
27 suppress this with "ticks off". Automatic ticks normally
28 leave a margin of 7% on each side; set this to anything by
29 margin = expr
30grid side linedesc at optname expr, expr, ...
31 draw grids perpendicular (!) to side in style linedesc
32 at expr, .... Iterators and labels work as with ticks.
33coord optname x min, max y min, max log x log y (x, y literal!)
34 set range of coords and optional log scaling on either or both
35 overrides computation of data range
36 default value of optname is current coordinate system
37 (each "coord" defines new coord system)
38plot "str" at point (or just "str" at point)
39 puts it at the point. you can add rjust, ljust, above, below after "...".
40line from point to point linedesc
41 draw line from here to there.
42 "arrow" works in place of line.
43next optname at point linedesc
44 continues plot of data in optname to point;
45 default is current
46draw optname linedesc "..."
47 set mode for next: use this style from now on,
48 and plot "..." at each point (if given)
49new optname linedesc "..."
50 set mode for next, but disconnect from previous
51numberlist
52 x y1 y2 y3 ...
53 treated as
54 plot bullet at x,y1
55 plot bullet at x,y2
56 plot bullet at x,y3
57 etc., or as next at x,y1 etc., if draw specified.
58 abscissae of 1,2,3,... provided if only one input number per line
59
60point
61 optname expr, expr
62 maps the point to the coordinate system
63linedesc
64 dot|dash|invis|solid optexpr
65define name % whatever %
66 macros just like in pic
67 There are macros already defined for standard plotting
68 symbols like bullet, circle, star, plus: cat /usr/lib/grap.defines,
69 which is included if it exists.
70var = expr
71 operators are = + - * / and ()
72 functions are log() and exp() (both base 10!), sin(), cos(), sqrt();
73 rand() returns random number on [0,1);
74 max(e,e), min(e,e), int(e).
75print expr; print "..."
76 as a debugging aid, prints expr or string on the standard error
77copy "filename"
78 include this file right here
79copy thru macro
80 pass rest of input (until .G2) through macros,
81 treating each field (non-blank, or "...") as an argument.
82 "macro" can be the name of a macro previously defined,
83 or the body of one in place, like / plot $1 at $2,$3 /
84copy thru macro until "string"
85 stop copy when input is string (left-justified)
86copy "filename" thru macro until "string"
87 combinations work too
88pic remainder of line
89 copied to output with leading blanks removed.
90graph Name pic-position
91 start a new frame, place it at specified position,
92 e.g., graph Thing2 with .sw at Thing1.se + (0.1,0)
93 Name is capitalized to keep pic happy.
94.anything at beginning of line
95 copied untouched
96sh X anything X
97 passes everything between the X's to the shell;
98 as with macros, X may be any character and "anything"
99 may include newlines.
100# anything after # is a comment
101.G2
102
103Order is mostly irrelevant; no category is mandatory.
104The simplest graphs are like
105 .G1
106 1
107 2
108 .G2
109or
110 .G1
111 1 2
112 3 4
113 5 6
114 .G2
115More complicated is like
116.G1
117frame top invis right invis
118coord x 0, 10 y 1, 5 log y
119ticks left in at 1 "bottommost tick", 2,3,4,5 "top tick"
120ticks bot in from 0 to 10 by 2
121label bot "this is a" "silly graph"
122label left "left side label" "here"
123grid bot dotted at 2,4,6,8
124grid left dashed at 2.5
125
126copy thru / plot circle at $1,$2 /
1271 1
1282 1.5
1293 2
1304 1.5
13110 5
132.G2
133