plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

plot.7 (6910B)


      1 .TH PLOT 7
      2 .SH NAME
      3 plot \- graphics interface
      4 .SH DESCRIPTION
      5 Files of this format are interpreted by
      6 .IR  plot (1)
      7 to draw graphics on the screen.
      8 A
      9 .I plot
     10 file is a
     11 .SM UTF
     12 stream of
     13 instruction lines.
     14 Arguments are delimited by spaces, tabs, or commas.
     15 Numbers may be floating point.
     16 Punctuation marks (except 
     17 .LR : )
     18 ,
     19 spaces, and tabs at the beginning of lines are ignored.
     20 Comments run from  
     21 .L :
     22 to newline.
     23 Extra letters appended to a valid instruction are ignored.
     24 Thus
     25 .LR ...line ,
     26 .LR line , and 
     27 .L li
     28 all mean the same thing.
     29 Arguments are interpreted as follows:
     30 .TP
     31 1.
     32 If an instruction requires no arguments, the rest of the line is ignored.
     33 .TP
     34 2.
     35 If it requires a string argument, then all the line
     36 after the first field separator is passed as argument.
     37 Quote marks may be used to preserve leading blanks.
     38 Strings may include newlines represented as
     39 .LR \en .
     40 .TP
     41 3.
     42 Between numeric arguments alphabetic characters and
     43 punctuation marks are ignored.
     44 Thus
     45 .L
     46 line from 5 6 to 7 8
     47 draws a line from (5, 6) to (7, 8).
     48 .TP
     49 4.
     50 Instructions with numeric arguments remain in effect until
     51 a new instruction is read.
     52 Such commands may spill over many lines. Thus
     53 the following sequence will draw a polygon
     54 with vertices
     55 (4.5, 6.77), (5.8, 5.6), (7.8, 4.55), and (10.0, 3.6).
     56 .IP
     57 .EX
     58 move 4.5 6.77
     59 vec 5.8, 5.6 7.8
     60 4.55 10.0, 3.6 4.5, 6.77
     61 .EE
     62 .PP
     63 The instructions are executed in order.
     64 The last designated point in a
     65 .BR line ", " move ", " rmove ,
     66 .BR vec ", " rvec ", " arc ,
     67 or
     68 .B point
     69 command becomes the `current point'
     70 .RI ( X,Y )
     71 for the next command.
     72 .SS "Open & Close"
     73 .PD0
     74 .TP 10
     75 .BI o " string"
     76 Open plotting device.
     77 For 
     78 .IR troff ,
     79 .I string
     80 specifies the size of the plot
     81 (default is
     82 .LR 6i ).
     83 .TP 10
     84 .B cl
     85 Close plotting device.
     86 .PD
     87 .SS "Basic Plotting Commands"
     88 .PD0
     89 .TP 10
     90 .B e
     91 Start another frame of output.
     92 .TP 10
     93 .BI m " x y"
     94 (move) Current point becomes
     95 .I "x y."
     96 .TP 10
     97 .BI rm " dx dy"
     98 Current point becomes
     99 .I "X+dx Y+dy."
    100 .TP 10
    101 .BI poi " x y"
    102 Plot the point
    103 .I "x y"
    104 and make it the current point.
    105 .TP 10
    106 .BI v " x y"
    107 Draw a vector from the current point to
    108 .I "x y."
    109 .TP 10
    110 .BI rv " dx dy"
    111 Draw vector from current point to
    112 .RI X + dx
    113 .RI Y + dy
    114 .TP 10
    115 .BI li " x1 y1 x2 y2"
    116 Draw a line from
    117 .I "x1 y1"
    118 to
    119 .I "x2 y2."
    120 Make the current point
    121 .I "x2 y2."
    122 .TP 10
    123 .BI t " string"
    124 Place the
    125 .I string
    126 so that its
    127 first character is centered on the current point (default).
    128 If
    129 .I string
    130 begins with
    131 .L \eC
    132 .RL ( \eR ),
    133 it is centered (right-adjusted) on the current point.
    134 A backslash at the beginning of the string may
    135 be escaped with another backslash.
    136 .TP 10
    137 .BI a " x1 y1 x2 y2 xc yc r"
    138 Draw a circular arc from
    139 .I "x1 y1"
    140 to
    141 .I "x2 y2"
    142 with center
    143 .I "xc yc"
    144 and radius
    145 .IR r .
    146 If the radius is positive, the arc is drawn counterclockwise;
    147 negative, clockwise.
    148 The starting point is exact but the ending point is approximate.
    149 .TP 10
    150 .BI ci " xc yc r"
    151 Draw a circle centered at
    152 .I "xc yc"
    153 with radius
    154 .IR r .
    155 If the range and frame parameters do not specify a square,
    156 the `circle' will be elliptical.
    157 .TP 10
    158 .BI di " xc yc r"
    159 Draw a disc centered at
    160 .I "xc yc"
    161 with radius
    162 .I r
    163 using the filling color (see 
    164 .B cfill
    165 below).
    166 .TP 10
    167 .BI bo " x1 y1 x2 y2"
    168 Draw a box with lower left corner at
    169 .I "x1 y1"
    170 and upper right corner at
    171 .I "x2 y2."
    172 .TP 10
    173 .BI sb " x1 y1 x2 y2"
    174 Draw a solid box with lower left corner at
    175 .I "x1 y1"
    176 and upper right corner at
    177 .I "x2 y2"
    178 using the filling color (see 
    179 .B cfill
    180 below).
    181 .TP 10
    182 .BI par " x1 y1 x2 y2 xg yg"
    183 Draw a parabola from
    184 .I "x1 y1"
    185 to
    186 .I "x2 y2"
    187 `guided' by
    188 .I "xg yg."
    189 The parabola passes through the midpoint of the line joining
    190 .I "xg yg"
    191 with the midpoint of the line
    192 joining
    193 .I "x1 y1"
    194 and
    195 .I "x2 y2"
    196 and is tangent to the lines from
    197 .I "xg yg"
    198 to the endpoints.
    199 .TP 10
    200 .BI "pol { {" "x1 y1 ... xn yn" } " ... " { "X1 Y1 ... Xm Ym\fP} }\fI"
    201 Draw polygons with vertices
    202 .I "x1 y1 ... xn yn"
    203 and
    204 .I "X1 Y1 ... Xm Ym."
    205 If only one polygon is specified, the inner brackets are
    206 not needed.
    207 .TP 10
    208 .BI "fi { {" "x1 y1 ... xn yn" } " ... " { "X1 Y1 ... Xm Ym\fP} }\fI"
    209 Fill a polygon.
    210 The arguments are the same as those for
    211 .B pol
    212 except that the first vertex is automatically repeated to
    213 close each polygon.
    214 The polygons do not have to be connected.
    215 Enclosed polygons appear as holes.
    216 .TP 10
    217 .BI "sp { {" "x1 y1 ... xn yn" } " ... " { "X1 Y1 ... Xm Ym\fL} }\fI"
    218 Draw a parabolic spline guided by
    219 .I "x1 y1 ... xn yn"
    220 with simple endpoints.
    221 .TP 10
    222 .BI "fsp { {" "x1 y1 ... xn yn" } " ... " { "X1 Y1 ... Xm Ym\fL} }\fI"
    223 Draw a parabolic spline guided by
    224 .I "x1 y1 ... xn yn"
    225 with double first endpoint.
    226 .TP 10
    227 .BI "lsp { {" "x1 y1 ... xn yn" } " ... " { "X1 Y1 ... Xm Ym\fL} }\fI"
    228 Draw a parabolic spline guided by
    229 .I "x1 y1 ... xn yn"
    230 with double last endpoint.
    231 .TP 10
    232 .BI "dsp { {" "x1 y1 ... xn yn" } " ... " { "X1 Y1 ... Xm Ym\fL} }\fI"
    233 Draw a parabolic spline guided by
    234 .I "x1 y1 ... xn yn"
    235 with double endpoints.
    236 .TP 10
    237 .BI "csp { {" "x1 y1 ... xn yn" } " ... " { "X1 Y1 ... Xm Ym\fL} }\fI"
    238 .TP 10
    239 .BI in " filename"
    240 (include) Take commands from
    241 .IR filename .
    242 .TP 10
    243 .BI de " string " { " commands " }
    244 Define
    245 .I string
    246 as
    247 .IR commands .
    248 .TP 10
    249 .BI ca " string scale"
    250 Invoke commands defined as
    251 .I string
    252 applying
    253 .I scale
    254 to all coordinates.
    255 .PD
    256 .SS "Commands Controlling the Environment"
    257 .PD0
    258 .TP 10
    259 .BI co " string"
    260 Use color given by first character of
    261 .IR string ,
    262 one of
    263 .BR red ,
    264 .BR yellow ,
    265 .BR green ,
    266 .BR blue ,
    267 .BR cyan ,
    268 .BR magenta ,
    269 .BR white ,
    270 and
    271 .BR kblack .
    272 If
    273 .I string
    274 begins with a digit, it is taken to be
    275 a 32-bit number specifying 8 bit each of red, green, blue, and alpha.
    276 For example,
    277 .B 0xFFFF00FF
    278 denotes solid yellow.
    279 .TP 10
    280 .BI pe " string"
    281 Use
    282 .I string
    283 as the style for drawing lines.
    284 The available pen styles are:
    285 .BR solid ,
    286 .BR  dott [ed],
    287 .BR short ,
    288 .BR long ,
    289 .BR dotd [ashed] ,
    290 .BR cdash ,
    291 .BR ddash
    292 .TP 10
    293 .BI cf " string"
    294 Color for filling (see
    295 .BR co ,
    296 above).
    297 .TP 10
    298 .BI ra " x1 y1 x2 y2"
    299 The data will fall between
    300 .I "x1 y1"
    301 and
    302 .I "x2 y2."
    303 The plot will be magnified or reduced to fit
    304 the device as closely as possible.
    305 .IP
    306 Range settings that exactly fill the plotting area
    307 with unity scaling appear below for
    308 devices supported by the filters of
    309 .IR  plot (1).
    310 The upper limit is just outside the plotting area.
    311 In every case the plotting area is taken to be square;
    312 points outside may be displayable on
    313 devices with nonsquare faces.
    314 .TP 10
    315 .BI fr " px1 py1 px2 py2"
    316 Plot the data in the fraction of the display
    317 specified by
    318 .I "px1 py1"
    319 for lower left corner
    320 and
    321 .I "px2 py2"
    322 for upper right corner.
    323 Thus  
    324 .L frame .5 0 1. .5
    325 plots in the lower right
    326 quadrant of the display;
    327 .L frame 0. 1. 1. 0.
    328 uses the whole display but
    329 inverts the
    330 .I y
    331 coordinates.
    332 .TP 10
    333 .B sa
    334 Save the current environment, and move to a new one.
    335 The new environment inherits the old one.
    336 There are 7 levels.
    337 .TP 10
    338 .B re
    339 Restore previous environment.
    340 .PD
    341 .SH "SEE ALSO"
    342 .IR plot (1), 
    343 .MR graph (1)