home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 266_01 / plox.doc < prev    next >
Text File  |  1990-07-21  |  16KB  |  313 lines

  1.                        micro PLOX                          PLOX.DOC
  2.                        Version 5.0
  3.  
  4.                        Bob Patton
  5.                   1713 Parkcrest Terrace
  6.                    Arlington, TX 76012
  7.                        July 1990
  8.  
  9. Micro PLOX is a plotting language that gives the user direct control
  10. of the plotting features of a dot matrix printer or a graphics
  11. monitor.  It was designed with graphs in mind, but it can be used
  12. to make forms and straight line drawings.
  13.  
  14. It will draw lines in various patterns and print text in 2 compact
  15. fonts.  The maximum area of a single drawing is 7 inches wide by
  16. 5 inches high which is roughly half of a standard typewriter page
  17. with margins allowed.  From data it will draw line or bar graphs.
  18. The lines may be of various patterns and colors and the points may
  19. be shown with a symbol or not.  The bars may have various hatching
  20. patterns.  The text may be located at a specific location with a
  21. TITLE or may be located relative to data with a LABEL.
  22.  
  23. Statements in PLOX consist of a keyword (in capitals recommended for
  24. readability) followed by options in lower case and digits. (Text strings
  25. should be upper and lower case as wanted.  File names may be upper or
  26. lower case.) For example:
  27.  
  28.   *    Sample stock plot
  29.   PIC size 7 by 2.5  outline
  30.   TITLE at 3.5,2.4 text NORTHEAST INVESTOR'S TRUST
  31.   AREA at .5,.5  size 6 by 1.8
  32.   AXIS left  to 30
  33.   AXIS below  from 85 to 88 boxes=3
  34.   LINE file  B:NOEAST.DAT  item 1 is yymmdd
  35.  
  36. PLOX is interpretive;  items specified are drawn as they are
  37. encountered so the statements must be pretty much in the order
  38. shown.  PIC must come first as it starts the process and sets
  39. the reference point for further dimensions given.
  40.  
  41. TITLE may come anyplace but its location will be affected by what
  42. has come before it. In the example above the title is centered at
  43. coordinates 3.5,2.4 inches with respect to the whole picture which
  44. has a size of 7 inches wide by 2.5 inches high.
  45.  
  46. An AREA is a rectangular field in which to put plots.  It has a
  47. location (of the lower, left corner) and a size.  Any titles given
  48. after an AREA are located with respect to the location of the AREA.
  49.  
  50. Both an x and a y AXIS must be specified to scale the data.  An AXIS
  51. is presumed to start at 0 unless shown otherwise by a "from" option.
  52. You may specify the number of scale divsions as "boxes" or let PLOX
  53. do it for you.
  54.  
  55. A LINE may now be drawn from a data file with a pairs of x and y data
  56. points.  You must give the name of the data file.  You may have date
  57. data in the form yymmdd and so specify to PLOX.  These will be converted
  58. to YY.fract for plotting.  For example 870630 might be converted to
  59. 87.496.
  60.  
  61. BARS may also be drawn from x and y data pairs.  The bars may be
  62. horizontal or vertical and will normally extend from the data point to
  63. the axis, but you may specify a different base (in data-units, not inches).
  64. You may specify the width of a bar (in inches).
  65.  
  66. You can in general have more than one of each statement (except PIC).
  67. Just remember that order counts.  You can have many LINEs in an AREA.
  68. You can have many AREAs in a PIC, and you can put TITLEs anywhere.
  69. You can even put more than 2 axes on a area, but the data plotted will
  70. be scaled to the last x and last y AXIS given.
  71.  
  72. The options on a given statement may come in any order and may be spaced
  73. to suit yourself.  The only current exception is the text of a title
  74. which must be last and may be on a separate TITLE statement if it is
  75. long.  The title is drawn as soon as the text is encountered.  There are
  76. optional punctuation and filler words for readability.  You may use
  77. commas and equal signs anywhere.  The words "by", "is", and "are" are
  78. ignored.   Comments may be included with PLOX statements by starting
  79. the comment line with an asterisk.
  80.  
  81.               Getting a plot printed
  82.  
  83. This is a two step process.  Write the PLOX statements and provide a
  84. data file with the numbers to be plotted.  A naming convention is
  85. recommended.  We suggest .PIC for the PLOX statements and .DAT for
  86. data files.  Execute the PLOX command giving the name of your file
  87. of PLOX statements:
  88.  
  89.                PLOX MYPLOX.PIC
  90.  
  91. This will create a binary file of plot commands named PLOTCOM.DAT.
  92. Then run program PLOTEPS or PLOTEPS2 which will output directly to
  93. your printer.  As the name suggests this device driver is for Epson
  94. printers, but device drivers for graphics monitors are also provided.
  95.  
  96.                PLOTEPS   or  PLOTEPS2
  97.  
  98. That's all there is to it.  PLOTEPS expects its input in PLOTCOM.DAT
  99. which is a little limiting, but simple to run and less error prone.
  100. There is really not much need to save the binary file of plot commands
  101. since it can always be recreated from the PLOX statements, but you
  102. could rename it if you did want to keep it.
  103.  
  104. If your printer ribbon is worn or you are making a chart for photo
  105. copying you can add the letter d after the command to get dark print
  106. which is done by just printing each line twice.  For example:
  107.  
  108.               PLOTEPS d
  109.  
  110. You can also view the chart on a graphics monitor if you have one.
  111. Simply use PLOTHERC, PLOTCGA, PLOTEGA, or PLOTVGA as the second
  112. command.  You can use this to debug charts or as the only way you
  113. look at charts.  If you are debugging for final print, note that the
  114. binary file still exists so all you have to do is issue a PLOTEPS
  115. to get the printed version once you like what you see on the screen.
  116. We recommend PLOTEGA even on a VGA monitor as the lettering size is
  117. more pleasing.
  118.  
  119. While PLOX is running it will echo your statements and print any errors
  120. found underneath them.  You can then correct and rerun before you plot.
  121.  
  122.  
  123.                     Data for plotting
  124.  
  125. The data to be plotted must be columns of numbers separated by one or
  126. more blanks.  You may have up to 14 columns in any one file.  Dates may
  127. be given in the form yymmdd and they will be translated to YY.frac for
  128. plotting if the plotting statement (e.g., LINE) specifies it.  Years
  129. less than 50 will have 100 added to allow for dates in the first half
  130. of the 21st century.  Missing numbers may be shown by a single asterisk
  131. (*) and they will be skipped.
  132.  
  133. The columns are referenced by number (1, 2, etc.) from left to right
  134. and are known as items to PLOX.  If not specified, PLOX assumes that
  135. item 1 is the x-value and item 2 the y-value to be plotted.  Plotting
  136. statements may specify which items to plot as:
  137.  
  138.        items ix iy
  139.  
  140. where ix is the x-value column number and iy the y-value column number.
  141. Thus with 3 sets of numbers to plot versus the same set of dates you
  142. could put the dates in column 1 and the numbers in columns 2, 3, and 4
  143. and plot them as follows.
  144.  
  145.    LINE file DATA.DAT items 1 2  item 1 is yymmdd
  146.    LINE file DATA.DAT items 1 3  item 1 is yymmdd
  147.    LINE file DATA.DAT items 1 4  item 1 is yymmdd
  148.  
  149. You may include comment lines in data by starting the line with a slash.
  150. Why not an asterisk for consistency?  Because asterisk is reserved to
  151. show missing values and this in turn is to be consistent with some
  152. other languages (including main frame PLOX) as was the use of
  153. asterisk for comments in statements to begin with.  Sorry about that.
  154.  
  155. You may further elect to have the data for any single plot
  156. immediately follow the plot statement (LINE or BARS) by specifying
  157. file *.  Such data must be ended by a dollar sign ($) in column one.
  158. In this case it would be pointless to have more than 2 columns of
  159. data as that's all you can plot with a single statement.  See the
  160. legend data of BIKE.PIC for an example of this.
  161.  
  162. Another option is to give the data file name as @.  Then you may put
  163. the actual file to use on the PLOX command line, or if you don't put
  164. it there you will be prompted for it.  This may be combined with PLOX
  165. statements allowed in the data file to let you make any number of
  166. similar charts from a single picture description using a different data
  167. file for each chart. See the FUNDINFO.PIC file and associated data files
  168. FUND01.DAT and FUND02.DAT for examples of this.
  169.  
  170.                  Other PLOX features
  171.  
  172. The separate reference summary document (PLOX.REF) shows the full
  173. syntax of the language.  Most of the notation should be clear at this
  174. point, but here are a few further notes.
  175.  
  176. As well as setting the size and optionally outlining a PIC, you may
  177. give margin = <number>.  The number is the column number on the printer
  178. in which you want the picture to start drawing.  The default is 5.  The
  179. expected use for this is to put two small pictures side by side or as a
  180. crude way to mix text and graphics on the same line.  In either case you
  181. will have to manually roll down the paper on the printer to draw the
  182. chart that sits beside an existing chart or text.
  183.  
  184. A TITLE by default is centered on its coordinate, but you may specify left
  185. or right justified.  The text is horizontal by default, but you may
  186. specify vertical.  In this case the letters are still upright but stacked
  187. on top of each other and the lettering starts at the given coordinate
  188. and goes down.  There are 2 fonts: font 1 (3 by 5 pixels, upper case)
  189. and font 2 (5 by 6, upper and lower case).
  190.  
  191. An AREA may be outlined if you wish.  This is one way to create forms.
  192.  
  193. An AXIS must located relative to an AREA.  Its range is given as
  194. from value-1 to value-2, but value-1 can be omitted and will default
  195. to zero.  If no range is given 0 to 100 is assumed.  You can specify
  196. the number of scale divisions as boxes or you can let the internal
  197. scaling routines choose for you.  The scaling routines do a pretty
  198. good job most of the time, but you might not always like their choice.
  199. Notice that an AXIS can be made invisible.  What for?  Well a series
  200. of areas right on top of each other might just share one printed axis
  201. for space saving.  Further you can use this feature to make simple line
  202. drawings.   Put ranges on the invisible axes that represent the span
  203. covered in inches.  Then make a set of data points that are the
  204. coordinates of the line drawing and draw a line through them.
  205.  
  206. A LINE may be solid or one of several dot or dash patterns.  Be aware
  207. though that dot matrix lines at angles do not show their patterns well.
  208. The dotted and spotted patterns are probably the best to use on a slant.
  209. A LINE may also be invisible, but note that the points on a line can
  210. be optionally marked by a symbol.  For a scatter diagram turn on the
  211. points and make the line invisible.  Of course you can have both the
  212. line and the points show up.  The use of "items ix iy" and "item n is"
  213. are described under "Data for plotting" above.
  214.  
  215. BARS may be shaded with a hatch pattern that is left diagonal, right
  216. diagonal, vertical, horizontal, or square.  You set the spacing between
  217. lines (in units of line widths) as gap = n.  A gap of 1 for any pattern
  218. gives a solid bar.  A gap of 2 for a diagonal pattern gives a uniform
  219. gray shade.  The shading patterns replace what was in the bar, not just
  220. overlay it.  Thus a grid line will not show inside a bar provided the
  221. grid line was drawn before the bar was.
  222.  
  223. Groups of BARS over the same data point may be placed side by side by the
  224. keyword phrase "abut m of n".  With 3 sets of bars you could: abut 1 of 3,
  225. abut 2 of 3, and abut 3 of 3.  This abutting feature can also be used to
  226. offset single sets of bars from their data points.
  227.  
  228. An ISO is a line of constant value (horizontal or vertical).  ISO's are
  229. handy for reference lines like time-now lines or data tolerance limits.
  230. They can also be used to make plot grids (which may be irregularly spaced).
  231. An ISO is speciifed at a data-value so an AXIS must have already been
  232. specified to make the data value meaningful.
  233.  
  234. A LABEL is like a TITLE, except that it is located at a pair of coordinates
  235. in data-values instead of inches.  This is very handy for annotating plot
  236. points of interest or annotating reference lines or creating a sort of
  237. legend by labelling lines or bars.
  238.  
  239. You specify color in micro PLOX in the simplest way, by a single
  240. statement of the form:  HUE color-name.  All plot objects following
  241. the HUE statement will be drawn in that color until another HUE
  242. statment is encountered.  HUE statements are ignored in monochrome
  243. device drivers.  The default color is chalk, which is a less bright
  244. white.   The HUE names are:
  245.  
  246.                   blue  pea  aqua coral plum  umber chalk
  247.              gray azure lime cyan peach lilac lemon white
  248.  
  249. These were chosen to be short and colorful (groan), or in many cases
  250. flavorful, while fairly well describing what they look like (on my
  251. monitor at least).
  252.  
  253.                         PLOX in Data
  254.  
  255. You have seen above that you can put the numeric data in your PLOX file
  256. (via file *).  It seems only fair that the converse be true and it is;
  257. you can put (some) PLOX statements in your numeric data file.  Why would
  258. you  want to do this you ask?  Well, the utility of it is that you can
  259. then have a single PLOX picture description file that draws any number of
  260. similar charts each with its own data.  To make this useful you must be
  261. able to specify the data file at the time you draw your chart, and you
  262. can do this, too.  Just specify the data file name as @ on your LINE or
  263. BARS statement.  Then you can put the data file name on the PLOX command
  264. line as the second parameter as in: PLOX  FUNDINFO.PIC  FUND02.DAT, or
  265. if you don't put it there PLOX will stop and ask you for the name when
  266. it is needed.
  267.  
  268. Okay that's fine for the different numeric data, but why would you need
  269. PLOX statements in the data.  The main reason is to allow you to change
  270. the text of TITLEs and LABELs.  You can also change the range of an AXIS
  271. and even have a feature on one chart that doesn't appear on another.
  272.  
  273. The statements you can put in a data file are TITLE, LABEL, AXIS, ISO,
  274. and HUE.  You identify such a statement as PLOX by starting it with
  275. an at-symbol, @, such as @TITLE or @AXIS.  A nice feature of TITLE in
  276. this regard is that the text part can be on a separate statement.  Thus
  277. you can put the location, size, font, and  color of a title in the
  278. picture file and just set the text in the data with a statement like:
  279.  
  280.             @TITLE text <the text here>
  281.  
  282. This brings to mind a key point.  What happens if you have more than
  283. one TITLE?  Things get a little tricky here so pay close attention.
  284. Since PLOX rereads the data file for each LINE or BAR it would tend to
  285. draw every PLOX feature in your data file for each plot.  What you need
  286. is a way to tell it during which LINE or BAR drawing action to use a
  287. given PLOX-in-data statement.  We made a compromise here.  In the typical
  288. data file with many columns there is one common set of x or horizontal
  289. data but there is a separate column of y data for each plot.  We have
  290. chosen to let the y data column number be the key to activating a PLOX-
  291. in-data statement.  Thus the full statement must consist of @ followed
  292. immediately by a single digit followed immediately by the PLOX keyword
  293. followed by the options you choose. For example:
  294.  
  295.         @2AXIS left range to 500
  296.  
  297. will draw a left axis on whatever AREA is current when the LINE or set of
  298. BARS that uses item n 2 is being drawn, i.e., the y item number is 2.
  299. This is a little subtle, but is a very powerful feature if you have a
  300. lot of charts that look alike.  It makes it especially easy to change
  301. the look of the whole set of charts.
  302.  
  303. With regard to the question of TITLE text you must realize that PLOX
  304. will already have moved to an AREA to start drawing a LINE or BAR.  Thus
  305. the TITLE location must be set relative to the location (lower left corner)
  306. of the AREA.  Okay, all this is difficult, but you don't have to use it,
  307. and the program is free.  It might help to both study and run the examples
  308. provided by FUNDINFO.PIC with FUND01.DAT and FUND02.DAT.
  309.  
  310. A further current limitation (due to the developer's laziness) is that the
  311. number following the @ before the PLOX keyword must be a single digit only
  312. so you can't use 10 and up.  Sorry about that one, too.
  313.