Docstoc

draw

Document Sample
draw Powered By Docstoc
					                          Search
Search:

         Login
         Help/Guide
         About Trac
         Preferences

         Wiki
         Roadmap
         Browse Source
         View Tickets
         Search

Context Navigation
         Last Change
         Annotate
         Revision Log




root/trunk/GDE/PHYLIP/draw.doc @ 181

                   181
View revision:
                                   Go!
Visit:
     Revision 181, 34.0 KB (checked in by jobb, 11 years ago)
added new phylip version
    Property svn:eol-style set to native
    Property svn:keywords set to Author Date Id Revision


Lin
                                             Â
 e
 1
         Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
 2
         Â Â Â Â version 3.5c
 3
 4
Lin
                                                  Â
 e
 5 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â DRAWTREE and DRAWGRAM
 6
    (c) Copyright 1986-1993 by Joseph Felsenstein and by the UniversityÂ
 7
    of
 8 Washington. Written by Joseph Felsenstein. Permission is granted to copy this
 9 document provided that no fee is charged for it and that this copyright notice
10 is not removed.
11
    Â Â Â DRAWTREE and DRAWGRAM are interactive tree-plotting programs thatÂ
12
    take a
13 tree description in a file and read it, and then let you interactively make
14 various settings and then plot the tree on a laser printer, plotter, or dot
15 matrix printer.  In many cases (with IBM PC graphics, with a DEC graphics
16 terminal or with a Tektronix-compatible graphics terminal) you can preview the
17 resulting tree. This allows you to modify the tree until you like the result,
18 then plot the result. DRAWTREE plots unrooted trees and DRAWGRAM plots rooted
19 cladograms and phenograms. On good plotters or laser printers both can produce
20 fully publishable results. On dot matrix printers the results look grainy but
21 are good enough for overhead transparencies or slides for presentations.
22
       These programs are descended from PLOTGRAM andÂ
23
    PLOTREE written by
24 Christopher Meacham.  I have incorporated his code for fonts and his plotter
25 drivers, and in DRAWTREE have used some of his code for drawing unrooted trees.
26 In both programs I have also included some plotter driver code by David
27 Swofford, Julian Humphries and George D.F. "Buz" Wilson, to all of whom I am
28 very grateful.  Mostly, however, they consist of my own code. The font files
29 are printable-character recodings of the public-domain Hershey fonts, recoded
30 by Christopher Meacham.
31
       This document will describe the features common to both programs.Â
32
    Â The
    documents for DRAWTREE and DRAWGRAM describe the particular choices
33
    you can
    make in each of those programs.  The Appendix to this documentationÂ
34
    file
35 contains some pieces of C code that can be inserted to make the program handle
Lin
                                                  Â
 e
36 another plotting device -- the plotters by Calcomp.
37
38
39 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â A Short Introduction
40
41 Â Â Â To use DRAWTREE and DRAWGRAM, you must have
42
       (1) The compiled version of the program.  If you have not obtainedÂ
43
    a
44 version of PHYLIP precompiled for your machine, you will have to take the
45 source code given here and modify it for your C compiler and then compile it.
46 This is not too hard: it is discussed below.
47
48    (2) A tree file. Trees are described in the nested-parenthesis notation
    used throughout PHYLIP and standardized in an informal meeting of
49
    program
50 authors in Durham, New Hampshire in June, 1986. Trees for both programs may be
51 either bifurcating or multifurcating, and may either have or not have branch
52 lengths. Tree files produced by the PHYLIP programs are in this form.
53
54    (3) A font file. There are six font files distributed with PHYLIP: these
55 consist of three Roman, two Italic, and one Russian Cyrillic font, all from the
56 public-domain Hershey Fonts, in ASCII readable form.  The details of font
57 representation need not concern you; all you need to do is to copy the font
58 file corresponding to the font you want into the appropriate directory under
59 the appropriate file name, and let the program use it.  Or you can let the
60 program ask you for the name of the font file, which it will do if it does not
61 find one itself.  The six fonts are, respectively, a one- and a two-stroke
62 sans-serif Roman font, a three-stroke serifed Roman font, a two- and a three-
63
64
65 stroke serifed Italic font, and a two-stroke Cyrillic font for the Russian
66 language. If this is not clear just try them all.  Note that for Apple
67 Laserwriters (or other Postscript printers) several built-in fonts can be used
68 too.
69
70    (4) A plotting device, and if possible a screen on which you can preview
Lin
                                               Â
 e
71    the plot.  The programs work with Postscript-compatible laser printers, laser
72    printers compatible with the Hewlett-Packard Laserjet  series,  plotters
73    including Hewlett-Packard models, dot matrix printers including models by Epson
74    and Apple, graphics terminals from DEC and Tektronix, IBM PC graphics screens,
75    the PCX file format for the PC Paintbrush painting program, the PICT format for
76    the MacDraw drawing program, the file format for the public domain X-windows
77    drawing program "xfig", the X Bitmap format for X-windows, and, strangest and
78    most wonderful of all, the input format for the public-domain ray-tracing (3-
      dimensional rendering) program "rayshade".  You choose the plottingÂ
79
      and
80    previewing devices from a menu at run time, and these can be different.  There
81    are places in the source code for the program where you can insert code for a
82    new plotter, should you want to do that.
83
84       Once you have all these the programs should be fairly self explanatory,
85    particular if you can preview your plots so that you can discover the meaning
86    of the different options by trying them out.
87
88    Â Â Â Once you have a compiled version of the appropriate program, say DRAWGRAM,
89    and a file called (say) TREEFILE with the tree in it, and a font file (say
90    FONT2 which you have copied as a file called FONTFILE), all you do is run the
91    program DRAWGRAM.  It should automatically read the font and tree files, and
92    will ask you to choose the graphics devices. Then it will let you see the
93    options it has chosen, and ask you if you want to change these. Once you have
94    modified those that you want to, you can tell it to accept those. The program
95    will then allow you to preview the tree on your screen, if you have told it
96    that you have an appropriate graphics screen (the PCDOS and 386 PCDOSÂ versions
      of the program will automatically adapt to a number of the commonest
97
      PC
 98   graphics boards, and the Macintosh version will adapt to the Macintosh screen).
 99   After previewing the tree, it will ask if you are ready to plot the tree. If
100   you say no, it will once again allow you to change options and will the allow
101   you to preview the tree again, and so on as many times as you want. If you say
102   yes, then it will write a file called (say) PLOTFILE. If this file is copied
103   directly to your plotter or printer, it should result in a beautifully plotted
104   tree. If the final plotting device is a DEC or PCDOS graphics screen, it may
105   not write a plot file but will plot directly on the screen.
Lin
                                                           Â
 e
106
         Having read the above, you may be ready to run the program.  BelowÂ
107
      you
108   Will find more information about representation of trees in the tree file, on
109   the different kinds of graphics devices supported by this program, and on how
110   to recompile these programs. If you have (for example) a PCDOS system and a
111   compiled version of the program, then all you have to do is have a tree file
112   called TREEFILE, a font file called FONTFILE, and run the program. Then copy
113   PLOTFILE to your plotter or printer.
114
115
116   Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Trees
117
118      The New Hampshire Standard for representing trees in computer-readable
119   form makes use of the correspondence between trees and nested parentheses,
120   noticed in 1857 by the famous English mathematician Arthur Cayley. If we have
121   this rooted tree:
122
123
124
125
126
127
128   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â AÂ Â Â Â Â Â Â Â Â D
129   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â \Â Â Â Â Â EÂ Â Â /
130   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â Â \Â Â CÂ Â /Â Â Â /
131                                         \ ! /   /
132   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â Â Â \ ! /Â Â Â /
133   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   BÂ Â Â \!/Â Â Â /
134                                        \   o   /
135                                        \  !  /
136                                         \  !  /
137                                         \ ! /
138   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â Â Â\!/
139   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â Â Â \!/
140   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â   Â Â Â Âo
Lin
                                                    Â
 e
141   Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â!
142   Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â!
143
144   then in the tree file it is represented by the following sequence of printable
145   characters, starting at the beginning of the file:
146
147   (B,(A,C,E),D);
148
149 The tree ends with a semicolon. Everything after the semicolon in the input
150 file is ignored, including any other trees. The bottommost node in the tree is
151 an interior node, not a tip. Interior nodes are represented by a pair of
152 matched parentheses.  Between them are representations of the nodes that are
153 immediately descended from that node, separated by commas.  In the above tree,
154 the immediate descendants are B, another interior node, and D. The other
    interior node is represented  by  a  pair  of  parentheses,Â
155
    Â enclosing
156 representations of its immediate descendants, A, C, and E.
157
       Tips are represented by their names.  A name can be anyÂ
158
    string of
159 printable characters except blanks, colons, semcolons, parentheses, and square
160 brackets. In the programs a maximum of 30 characters are allowed for names:
161 this limit can easily be increased by recompiling the program and changing the
162 constant declaration for "nch" at the beginning of the program.
163
164    Because you may want to include a blank in a name, it is assumed that an
165 underscore character ("_") stands for a blank; any of these in a name will be
166 converted to a blank when it is read in. Any name may also be empty: a tree
167 like
168
169 (,(,,),);
170
171 is allowed.  Trees can be multifurcating at any level (while in many of the
172 programs multifurcations of user-defined trees are not allowed or restricted to
173 a trifurcation at the bottommost level, these programs do make any such
174 restriction).
175
Lin
                                                Â
 e
176      Branch lengths can be incorporated into a tree by putting a real number,
177   with or without decimal point, after a node and preceded by a colon. This
178   represents the length of the branch immediately below that node.  Thus the
179   above tree might have lengths represented as:
180
181   (B:6.0,(A:5.0,C:3.0,E:4.0):5.0,D:11.0);
182
183   These programs will be able to make use of this information only if lengths
184   exist for every branch, except the one at the bottom of the tree.
185
186      The tree starts on the first line of the file, and can continue to
187   subsequent lines. It is best to proceed to a new line, if at all, immediately
188   after a comma. Blanks can be inserted at any point except in the middle of a
189
190
191   species name or a branch length.
192
193      The above description is of a subset of the New Hampshire Standard.  For
194   example, interior nodes can have names in that standard, but if any are
195   included the present programs will omit them.
196
197      To help you understand this tree representation, here are some trees in
198   the above form:
199
200   ((raccoon:19.19959,bear:6.80041):0.84600,((sea_lion:11.99700,
201   seal:12.00300):7.52973,((monkey:100.85930,cat:47.14069):20.59201,
202   weasel:18.87953):2.09460):3.87382,dog:25.46154);
203
204   (Bovine:0.69395,(Gibbon:0.36079,(Orang:0.33636,(Gorilla:0.17147,(Chimp:0.19268,
205   Human:0.11927):0.08386):0.06124):0.15057):0.54939,Mouse:1.21460);
206
207   (Bovine:0.69395,(Hylobates:0.36079,(Pongo:0.33636,(G._Gorilla:0.17147,
208   (P._paniscus:0.19268,H._sapiens:0.11927):0.08386):0.06124):0.15057):0.54939,
209   Rodent:1.21460);
210
211   ();
Lin
                                                  Â
 e
212
213 ((A,B),(C,D));
214
215 (Alpha,Beta,Gamma,Delta,,Epsilon,,,);
216
       The New Hampshire Standard was adopted June 26, 1986 by anÂ
217
    informal
218 committee meeting during the Society for the Study of Evolution meetings in
219 Durham, New Hampshire and consisting of James Archie, William H.E. Day, Wayne
220 Maddison, Christopher Meacham, F. James Rohlf, David Swofford, and myself.
221
222
223 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Plotters
224
225 Â Â Â When the programs run they ask you to choose the final plotting device and
226 to indicate whether there is a preview screen and if so what it is. The
227 choices for previewing are a subset of those available for plotting, and they
228 can be different (the most useful combination will be a previewing graphics
229 screen with a hard-copy plotter or printer).
230
231 Â Â Â Here are the choices, with some comments on each:
232
233    Apple Laserwriter (with Postscript). This means that the program will
234 generate a file containing Postscript commands as its plot file. This can be
235 printed on any Postscript-compatible laser printer. The page size is assumed
236 to be 8.5 by 11 inches, but as plotting is within this limit A4 metric paper
237 should work well too. This is the best quality output option.  For this
238 printer the menu options in DRAWGRAM and DRAWTREE that allow you to select one
239 of the built-in fonts will work. I have been able to use fonts Courier,
240 Times-Roman, and Helvetica.  The others have eluded me for some reason known
241 only to those who really understand Postscript.
242
243    If your laser printer, supposedly Postcript-compatible, refuses to print
244 the plot file, you might consider whether the first line of the plot file,
245 which starts with "%!" needs to be altered somehow or eliminated.  If your
246 Laserwriter is hooked to a Macintosh it will be necessary to persuade it to
Lin
                                                     Â
 e
247   print the plot file. The public-domain utility SendPS enables one to do that:
248   it is provided by us with the Macintosh executable version of PHYLIP. If you
249   are compiling your own Macintosh version you should try to get SendPS: it is
250   available in libraries of Macintosh public domain programs. I have heard that
251   it does not work with the new System 7 version of the Mac operating system, but
252
253
254   that there is on the Printers diskette of the System 7 distribution diskettes a
255   utility called Laserwriter Font Utility that can accomplish the same task.
256
257      Hewlett-Packard Laserjet laser printers. This extremely popular line of
258   laser printers is also emulated by many other brands of laser printer, in fact,
259   most of those that do not have Postscript. One limitation of the PCL4 command
260   language for these printers is that they do not have primitive operations for
261   drawing arbitrary diagonal lines. This means that they must be treated by
262   these programs as if they were dot matrix printers with a great many dots.
263   This makes output slow. The user will be asked to choose the dot resoluton
264   (75, 150, or 300 dots per inch). The 300 dot per inch setting is not possible
265   unless you have expanded the laser printer's memory beyond 512K bytes.  The
266   quality of output is also not as good as it might be (I hope to correct this in
267   the future) so that the Postscript printers will produce better results even at
268   the same resolution. Note that there are cartridges that can be bought to make
      a Laserjet print Postscript, and see below (under Hewlett-PackardÂ
269
      7470
270   plotters) for the fact that Laseret III's can emulate an HP plotter.  I am
271   grateful to Kevin Nixon for inadvertantly pointing out that on Laserjets one
272   does not have to dump the complete bitmap of a page to plot a tree.
273
274      Tektronix 4010 graphics terminal. The plot file will contain commands for
275   driving the Tektronix series of graphics terminals.  Many other graphics
276   terminals are compatible with the Tektronix 4010 and its immediate descendants.
277   The PCDOS version of the public domain communications program Kermit, versions
278   2.30 and later, can emulate a Tektronix graphics terminal if the command "set
279   terminal tek" is given. Of course that assumes that you are communicating with
280   another computer. There are also similar terminal emulation programs for
281   Macintoshes that emulate Tektronix graphics. On workstations with X windows
Lin
                                               Â
 e
282   you can use one option of the "xterm" utility to create a Tektronix-compatible
283   window.  On Sun workstations there is a Tektronix emulator you can run called
284   "tektool" which can be used to view the trees. The Tektronix option is also
285   available for previewing, in which case the plotting commands will be not be
286   written into a file but will be sent directly to your terminal.
287
288      Hewlett-Packard 7470. This means that the program will generate a file as
289   its plot file which uses the HPGL graphics language. Hewlett-Packard 7470,
290   7475, and many other plotters are compatible with this.  The paper size is
291   again assumed to be 8.5 by 11 inches (again, A4 should work well too). It is
292   assumed that there are two pens, a finer one for drawing names, and the HPGL
293   commands will call for switching between these. The Hewlett-Packard Laserjet
294   III printer can emulate an HP plotter, and this feature is included in its PCL5
295   command language (but not in the PCL4 command languages of earlier Hewlett-
296   Packard models).
297
298      IBM PC graphics screens. The code for this in the programs is available
299   in the precompiled PCDOS executables or if you compile the programs yourself in
      C.  The graphics modes supported are CGA, EGA, VGA, Hercules,Â
300
      and ATT
301   (Olivetti).  modes if you want.  This option is available for previewing
302   plots, and in either previewing or final plotting it draws directly on the
303   screen and does not make a plot file.
304
         Macintosh graphics screens. Code has been inserted which will,Â
305
      when
306   compiled with Think C from Symantec, open a graphics window and draw preview
307   trees in it. At the moment I have not provided this option for final plotting
308   of the tree (this would add nothing). The window is 500 x 342 pixels and has
309   the tree drawn in black on a white background. Once the preview is drawn the
310   program runs in a tight loop, waiting for you to press the mouse button. When
311   it is pressed, the text window is made active and comes to the front.
312
       DEC ReGIS (VT 240 graphics terminal). The DEC ReGIS standard is usedÂ
313
    by
314 the VT240 and VT340 series terminals by DEC (Digital Equipment Corporation).
315
Lin
                                               Â
 e
316
317   There are many graphics terminals that emulate the VT240 or VT340 as well. For
318   example the DECTerm windows in many versions of Digital's DECWindows windowing
319   system do so. This option is available for previewing trees as well.  In
320   preview mode it does not write a plot file but sends the commands directly to
321   the screen; in final mode it writes a plot file. In DEC's version of Unix,
322   Ultrix version 4.1 and later, the windowing system allows DEC ReGIS graphics as
323   a default.
324
325      Houston Instruments plotters. The Houston Instruments line of plotters
326   has also been known as Bausch and Lomb plotters. The code in the programs for
327   these has not been tested recently; I would appreciate someone trying it out
328   and telling me whether it works.  I do not have access to such a plotter
329   myself.
330
331      Epson printers. The dot-matrix printers by Epson (starting with the MX80
332   and continuing on to many other models), as well as the IBM Graphics printers.
333   The code here plots in double-density graphics mode. Many of the later models
334   are capable of higher-density graphics but not with every dot printed. This
335   density was chosen for reasonably wide compatibility.  Many other dot-matrix
336   printers on the market have graphics modes compatible with the Epson printers.
337   I cannot guarantee that the plot files generated by these programs will be
338   compatible with all of these, but they do work on Epsons. They have also
339   worked, in our hands, on IBM Graphics Printers. There are many printers that
340   claim compatibility with these too, but I do not know whether it will work on
341   all of them. If you have trouble with any of these you might consider trying
342   in the epson option of procedure initplotter to put in a fprintf statement that
343   writes to plotfile an escape sequence that changes line spacing.
344
345      Prowriter/Imagewriter. The trading firm C. Itoh distributes this line of
346   dot-matrix printers, which is made by Tokyo Electric (TEC) and also was sold by
347   NEC under the product number PC8023. These are 9-pin dot matrix printers.  In
348   a slightly modified form they are also the Imagewriter printer sold by Apple
349   for their Macintosh line. The same escape codes seem to work on both machines,
350   the Apple version being a serial interface version. They are not related to
351   the IBM Proprinter, despite the name.
Lin
                                                Â
 e
352
353      Toshiba 24-pin printers. The 24-pin printers from Toshiba are covered by
354   this option.  These include the P1340, P1350, P1351, P351, 321, and later
355   models. For a 24-pin printer the plot file can get fairly large as it contains
356   a bit map of the image and there are more bits with a 24-pin image. Printing
357   will be slow.
358
359      Okidata printers. The ML81, 82, 83 and ML181, 182, 183 line of dot-matrix
360   printers from Okidata had their own graphics codes and those are dealt with by
361   this option. The later Okidata ML190 series emulates IBM Graphics Printers so
362   that you should not use this option for them but the option for that printer.
363
364      PC Paintbrush PCX files. It is desirable to have the program output trees
365   in at least one format that can be loaded into a paint program, so that
366   additional symbols and labels can be added. I have chosen the PCX file format
367   supported by the PC Paintbrush program. This file format is simple and is read
368   by many other programs as well. The user must choose one of three resolutions
369   for the file, 640x480, 800x600, or 1024x768. The file is a monochrome paint
370   file.
371
372      Xfig files. This is the file format of the public-domain drawing program
      Xfig available for X-windows systems on Unix workstations.  Xfig can
373
      be
374   obtained by ftp from various network servers such as export.lcs.mit.edu in
375   Â Â /contrib/R5fixes/xfig-patches/xfig.2.1.6.tar.Z.
376   You should also get transfig, which contains the fig2dev program which converts
377   xfig output to the various printer languages. Transfig is on the same machine
378
379
380   in
381   Â Â /contrib/R5fixes/transfig-patches/transfig.2.1.6.tar.Z.
382   The present format does not write the species labels in fonts recognized by
383   Xfig but draws them with lines. This often makes the names look rather bumpy.
384   We hope to change this soon.
385
         X Bitmap files. This produces an X-bitmap for the X windowingÂ
386
      system
Lin
                                              Â
 e
387   which can be displayed on X screens. You will be asked for the size of the
388   bitmap (e.g., 16x16, or 256x256, etc.). This format cannot be printed out
389   without further format conversion but is useable for backgrounds of windows
390   ("wallpaper"). This can be a very bulky format if you choose a large bitmap.
391
392      Rayshade files. This is the most unusual format of all. It is the input
393   format for the public-domain ray-tracing program "rayshade" which is available
      for Unix systems via anonymous ftp at princeton.edu in theÂ
394
      Â directory
395   pub/Graphics (note the capital letter). Rayshade takes files of this format
396   and turns them into color scenes in "raw" raster format (also called "MTV"
397   format after the common raytracing program of the same name). If you get the
      pbmplus package (available via anonymous ftp from gatekeeper.dec.comÂ
398
      in
399   /.9/X11/contrib/ppbmplus10dec91.tar.Z) and compile it on your system you can
400   use the "mtvtoppm" and "ppmtogif" programs to convert this into the widely-used
401   GIF raster format. (the pbmplus package will also allow you to convert into
402   tiff, pcx and many other formats) The resultant image will show a tree floating
403   above a landscape, rendered in a real-looking 3-dimensional scene with shadows
      and illumination. Rayshade is slow: it took 15 minutes on myÂ
404
      DECstation
405   5000/200 to make one illustration at 512x512 resolution. It is possible to use
406   it to make two scenes that together are a stereo pair. When producing output
      for Rayshade you will be asked by the DRAWGRAM or DRAWTREE whether you want
407
      to
408   reset the values for the colors you want for the tree, the species names, the
409   background, and the desired resolution.
410
411      Conversion from these formats to others is also possible.  The graphics
412   conversion utility HiJaak, from Inset Systems (71 Commerce Drive, Brookfield,
413   Connecticut 06804, (203) 775-5866) is a PCDOS program that converts numerous
414   graphic file formats on input and output. It can read many formats, including
415   the HPGL format and write many formats. It is available from many software
416   discount houses. There is also a public-domain program by Jef Poskanzer called
417   "PBMPLUS" that interconverts many bitmap formats.
418
419
Lin
                                             Â
 e
420   Â Â Â Â Â Â Â Â Â Â Â Problems Copying Files to Printers
421
422   Â Â Â A problem may arose in how to get the plot files to the plotting device or
423   printer.  One has to copy them directly, but one should be careful to not let
424   your serial or parallel port strip off the high-order bits in the bytes if you
425   are using one of the options that generate nonprintable characters. This will
426   be true for most of the dot matrix printers and for bitmaps dumped to an HP
427   Laserjet.  This can be a problem under Unix or PCDOS. If, for example, you
428   have a dot-matrix printer connected to a parallel port under PCDOS, to copy the
429   file PLOTFILE to the printer without losing the high-order bits, you must use
430   the /B switch on the COPY command:
431   Â COPY/B PLOTFILE PRN:
432
433
434   Â Â Â Â Â Â Â Â Â Â Â Â The VAX VMS Line Length Problem
435
436    A problem that may occur under some operating systems, particularly the
437 VMS operating system for DEC VAXes, is having a plot file with lines that
438 exceed some operating system limit such as 255 characters. This can happen if
439 you are using the Tektronix option.  You should set your terminal type with
    the command  $ SET TERM/NOWRAP/ESCAPE which will allow Tektronix and DEC
440
    ReGIS
441
442
443 plots to successfully appear on your terminal.  That way, if you have a
444 terminal capable of plotting one of these kinds of plots, the operating system
445 will not interfere with the process. It will not be possible to use files of
446 Tektronix commands as final plot files, however, as the TYPE command usually
447 used to get them to appear on the screen does not allow lines longer than 2048
448 bytes, and Tektronix plots are single lines longer than that.
449
450
451 Â Â Â Â Â Â Â Â Â Â Â Â Other problems and opportunities
452
453    Another problem is adding labels (such as vertical scales and branch
454 lengths) to the plots produced by this program. This may require you to use
Lin
                                                 Â
 e
455   the PCX, PICT, or Xfig file format and use a draw or paint program to add them.
456
457      I would like to add more fonts. The present fonts are recoded versions of
458   the Hershey fonts. They are legally publicly distributable. Most other font
459   families on the market are not public domain and I cannot afford to license
460   them for distribution. Some people have noticed that the Hershey fonts, which
461   are drawn by a series of straight lines, have noticeable angles in what are
462   supposed to be curves, when they are printed on modern laser printers and
463   looked at closely. This is less a problem than one might think since,
464   fortunately, when scientific journals print a tree it is usually shrunk so
465   small that these imperfections (and often the tree itself) are hard to see!
466
467      One more font that could be added from the Hershey font collection would
468   be a Greek font. If Greek users would find that useful I could add it, but my
469   impression is that they publish mostly in English anyway.
470
471
472   Â Â Â Â Â Â Writing Code for a new Plotter, Printer or File Format
473
474      The C version of these programs consists of two C programs, "drawgram.c"
      and "drawtree.c".  Each of these has a common section of codeÂ
475
      called
476   "drawgrahics.c" and a common header file, "drawgraphics.h".  IN addition the
477   Macintosh version requires two more files, "interface.c" and "interface.h".
478   All of the graphics commands that are common to both programs will be found in
479   "drawgraphics.c".  The following instructions for writing your own code to
480   drive a different kind of printer, plotter, or graphics file format, require
481   you only to make changes in "drawgraphics.c". The two programs can then be
482   recompiled.
483
484    If you want to write code for other printers, plotters, or vector file
485 formats, this is not too hard. The plotter option "U" is provided as a place
    for you to insert your own code.  Chris Meacham's system wasÂ
486
    to draw
487 everything, including the characters in the names and all curves, by drawing a
488 series of straight lines. Thus you need only master your plotter's commands
489 for drawing straight lines.  In procedure "plotrparms" you must set up the
Lin
                                               Â
 e
490   values of variables "xunitspercm" and "yunitspercm", which are the number of
491   units in the x and y directions per centimeter, as well as variables "xsize"
492   and "ysize" which are the size of the plotting area in centimeters in the x
493   direction and the y direction. A variable "penchange" of a user-defined type
494   is set to "yes" or "no" depending on whether the commands to change the pen
495   must be issued when switching between plotting lines and drawing characters.
496   Even though dot-matrix printers do not have pens, penchange should be set to
497   "yes" for them. In PROCEDURE plot you must issue commands to draw a line from
498   the current position (which is at (xnow, ynow) in the plotter's units) to the
499   position (xabs, yabs), under the convention that the lower-left corner of the
500   plotting area is (0.0, 0.0). In procedures "initplotter" and "finishplotter"
501   you must issue commands to initialize the plotter and to finish plotting,
502   respectively. If the pen is to be changed an appropriate piece of code must be
503   inserted in procedure "penchange".
504
505
         For dot matrix printers and raster graphics matters are a bitÂ
506
      more
507   complex. The procedures "plotrparms", "initplotter", "finishplotter" and "plot"
508   still respectively set up the parameters for the plotter, initialize it, finish
509   a plot, and plot one line. But now the plotting consists of drawing dots into
510   a two-dimensional array called "stripe". Once the plot is finished this array
511   is printed out. In most cases the array is not as tall as a full plot: instead
512   it is a rectangular strip across it. When the program has finished drawing in
513   ther strip, it prints it out and then moves down the plot to the next strip.
514   For example, for Hewlett-Packard Laserjets we have defined the strip as 2550
515   dots wide and 20 dots deep. When the program goes to draw a line, it draws it
516   into the strip and ignores any part of it that falls outside the strip.  Thus
517   the program does a complete plotting into the strip, then prints it, then moves
518   down the diagram by (in this case) 20 dots, then does a complete plot into that
519   strip, and so on.
520
521      To work with a new raster or dot matrix format, you will have to define
522   the desired width of a strip ("strpwide"), the desired depth ("strpdeep"), and
523   how many lines of bytes must be printed out to print a strip.  For example
524   Toshiba P351 printers in graphics mode print strips of dots 1350 bits wide by
Lin
                                                  Â
 e
525   24 bits deep, each column of 24 bits printing out as consecutive four bytes
526   with 6 bits each. In that case, one prints out a strip by printing up to 1350
527   groups of 4 bytes. "strpdiv" is 4, and "strpwide" is 1350, and "strpdeep" is
528   24.  procedure "striprint" is the one that prints out a strip, and has
529   special-case code for the different printers and file formats.  For file
530   formats, all of which print out a single row of dots at a time, the variable
531   "strpdiv" is not used. The variable "dotmatrix" is set to "true" or "false" in
532   procedure "plotrparms" according to whether or not "strpdiv" is to be used.
533   procedure "plotdot" sets a single dot in the array "strip" to 1 at position
534   (xabs, yabs).  The coordinates run from 1 at the top of the plot to larger
535   numbers as we proceed down the page. Again, there is special-case code for
536   different printers and file formats in that procedure.  You will probably want
537   to read the code for some of the dot matrix or file format options if you want
538   to write code for one of them. Many of them have provision for printing only
539   part of a line, ignoring parts of it that have no dots to print.
540
541      I would be happy to obtain the resulting code from you to consider adding
542   it to this listing so we can cover more kinds of plotters, printers, and file
543   formats.
544
      =================================================================
545
      ==========
546
         APPENDIX 1. Code to drive some other graphics devices.  These piecesÂ
547
      of
548   code are to be inserted in the places reserved for the "Y" plotter option. The
549   variables necessary to run this have already been incorporated into the
550   programs.
551   A global declaration needed near the front of drawtree.c:
552
553   Char cchex[16];
554
555   Code to be inserted into procedure plotrparms:
556
557   Â case 'Y':
558   Â Â plotter = other;
559   Â Â xunitspercm = 39.37;
Lin
                                                     Â
 e
560   Â   Â   yunitspercm = 39.37;
561   Â   Â   xsize = 25.0;
562   Â   Â   ysize = 25.0;
563   Â   Â   xposition = 12.5;
564   Â   Â   yposition = 0.0;
565   Â   Â   xoption = center;
566   Â   Â   yoption = above;
567
568
569   Â Â rotation = 0.0;
570   Â Â break;
571
572
573   Code to be inserted into procedure plot:
574
575   Declare these variables at the beginning of the procedure:
576
577   long n, inc, xinc, yinc, xlast, ylast, xrel,
578   Â Â yrel, xhigh, yhigh, xlow, ylow;
579   Char quadrant;
580
581   and insert this into the switch statement:
582
583   Â   case other:
584   Â   Â if (penstatus == pendown)
585   Â   Â Â putc('H', plotfile);
586   Â   Â else
587   Â   Â Â putc('D', plotfile);
588   Â   Â xrel = (long)floor(xabs + 0.5) - xnow;
589   Â   Â yrel = (long)floor(yabs + 0.5) - ynow;
590   Â   Â xnow = (long)floor(xabs + 0.5);
591   Â   Â ynow = (long)floor(yabs + 0.5);
592   Â   Â if (xrel > 0) {
593   Â   Â Â if (yrel > 0)
594   Â   Â Â Â quadrant = 'P';
595   Â   Â Â else
Lin
                                                    Â
 e
596   Â   Â   Â Â quadrant = 'T';
597   Â   Â   } else if (yrel > 0)
598   Â   Â   Â quadrant = 'X';
599   Â   Â   else
600   Â   Â   Â quadrant = '1';
601   Â   Â   xrel = labs(xrel);
602   Â   Â   yrel = labs(yrel);
603   Â   Â   if (xrel > yrel)
604   Â   Â   Â n = xrel / 255 + 1;
605   Â   Â   else
606   Â   Â   Â n = yrel / 255 + 1;
607   Â   Â   xinc = xrel / n;
608   Â   Â   yinc = yrel / n;
609   Â   Â   xlast = xrel % n;
610   Â   Â   ylast = yrel % n;
611   Â   Â   xhigh = xinc / 16;
612   Â   Â   yhigh = yinc / 16;
613   Â   Â   xlow = xinc & 15;
614   Â   Â   ylow = yinc & 15;
615   Â   Â   for (i = 1; i <= n; i++)
616   Â   Â   Â fprintf(plotfile, "%c%c%c%c%c",
617   Â   Â   Â Â Â Â Â quadrant, cchex[xhigh - 1], cchex[xlow - 1], cchex[yhigh - 1],
618   Â   Â   Â Â Â Â Â cchex[ylow - 1]);
619   Â   Â   if (xlast != 0 || ylast != 0)
620   Â   Â   Â fprintf(plotfile, "%c%c%c%c%c",
621   Â   Â   Â Â Â Â Â quadrant, cchex[-1], cchex[xlast - 1], cchex[-1],
622   Â   Â   Â Â Â Â Â cchex[ylast - 1]);
623   Â   Â   break;
624
625
626   Code to be inserted into procedure initplotter:
627
628   Â case other:
629   Â Â cchex[-1] = 'C';
630
631
Lin
                                                    Â
 e
632   Â   Â   cchex[0] = 'D';
633   Â   Â   cchex[1] = 'H';
634   Â   Â   cchex[2] = 'L';
635   Â   Â   cchex[3] = 'P';
636   Â   Â   cchex[4] = 'T';
637   Â   Â   cchex[5] = 'X';
638   Â   Â   cchex[6] = '1';
639   Â   Â   cchex[7] = '5';
640   Â   Â   cchex[8] = '9';
641   Â   Â   cchex[9] = '/';
642   Â   Â   cchex[10] = '=';
643   Â   Â   cchex[11] = '#';
644   Â   Â   cchex[12] = '"';
645   Â   Â   cchex[13] = ''';
646   Â   Â   cchex[14] = '^';
647   Â   Â   xnow = 0.0;
648   Â   Â   ynow = 0.0;
649   Â   Â   fprintf(plotfile, "CCCCCCCCCC");
650   Â   Â   break;
651
652
653   Code to be inserted into procedure finishplotter:
654
655   Â case other:
656   Â Â plot(penup, 0.0, yrange + 50.0);
657   Â Â break;
658
659
660
661
662
663
664
665
666
667
Lin
                                                Â
 e
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
Note: See TracBrowser for help on using the browser.
 View changes...



Download in other formats:

       Plain Text
       Original Format
Powered by Trac 0.11.4
By Edgewall Software.

This is the wiki and bug-tracker of the ARB Project
http://www.arb-home.de/

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:83
posted:5/17/2012
language:English
pages:22
fanzhongqing fanzhongqing http://
About