Annotation of researchv10no/cmd/grap/grap.1, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.