GRAP(1)

NAME
grap - pic preprocessor for drawing graphs

SYNOPSIS
grap [ files []]

DESCRIPTION
grap is a pic preprocessor for drawing graphs on a typesetter. A line beginning with the command marks the start of a graph; the end of a graph is marked by a line beginning with the command. Data that is enclosed is scaled and plotted, with tick marks supplied automatically.

grap commands are summarized below. Commands exist to modify the frame, add labels, override the default ticks, change the plotting style, define coordinate ranges and transformations, and include data from files. In addition, grap provides the same loops, conditionals and macro processing that pic does.

Predefined strings include bullet(,) plus(,) box(,) star(,) dot(,) times(,) htick(,) vtick(,) square(,) and delta(.) Built-in functions include (base 10), (base 10), int(,) sin(,) cos(,) atan2(,) sqrt(,) min(,) max(,) and rand(.)

Order is mostly irrelevant; no category is mandatory. Any arguments on the line are placed on the generated line for pic.

EXAMPLE
    .G1
    frame top invis right invis
    coord x 0, 10 y 1, 5 log y
    ticks left in at 1 "bottommost tick", 2,3,4,5 "top tick"
    ticks bot in from 0 to 10 by 2
    label bot "this is a" "silly graph"
    label left "left side label" "here"
    grid bot dotted at 2,4,6,8
    grid left dashed at 2.5
    copy thru / circle at $1,$2 /
    1 1
    2 1.5
    3 2
    4 1.5
    10 5
    .G2

FILES

SEE ALSO
graph(1), pic(1), plot(3)

REFERENCES
J. L. Bentley and B. W. Kernighan, GRAP — A Language for Typesetting Graphs

SUMMARY
In this command summary, italic terms are syntactic categories, terms are literals, parenthesized constructs are optional, and indicates repetition.

(width in inches)
grap statement
frame | label | coord | ticks | grid | plot | line | circle | draw | new | next
| graph | numberlist | copy | for | if | pic | assignment | print | define | copy | sh expr) expr) ((side) linedesc) | | | | | (expr) | (expr) side strlist shift | | | expr str | | | below()) (±) expr) (name) expr) expr) | | log log()) side | (expr)) (shift) (tick-locations) (name) expr (str), expr (str)
| (name) expr expr ((by) ((+) | | | /()) expr) str side (linedesc) (shift) (tick-locations) strlist point | expr (str) point (name) | arrow()) point point (linedesc) point expr) (name) linedesc (str) (name) linedesc (str) (name) point (linedesc) number var expr expr | | | /()) expr) X anything X expr X anything X X anything X Picname (pic-text) (expr | str) macro_name X anything X ("filename") macro_name | X macro_body X) X anything X anything var expr any single character, or braces

Order is mostly irrelevant; no category is mandatory.

CAVEATS
If using both coord and ticks statements, specify coord before marking ticks; otherwise you may not receive any graphic output.