gview 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. .TH GVIEW 1
  2. .SH NAME
  3. gview \- interactive graph viewer
  4. .SH SYNOPSIS
  5. .B gview
  6. [
  7. .B -mp
  8. ]
  9. [
  10. .B -l
  11. .I logfile
  12. ]
  13. [
  14. .I files
  15. ]
  16. .SH DESCRIPTION
  17. .I Gview
  18. reads polygonal lines or a polygonal line drawing from an
  19. .B ASCII
  20. input file (which defaults to standard input), and views it interactively,
  21. with commands to zoom in and out, perform simple editing operations, and
  22. display information about points and polylines. (Multiple input files are
  23. allowed if you want to overlay several line drawings.) The editing commands can
  24. change the color and thickness of the polylines, delete (or undelete)
  25. some of them, and optionally rotate and move them. It is also possible to
  26. generate an output file that reflects these changes and is in the same format
  27. as the input.
  28. .PP
  29. Since the
  30. .B move
  31. and
  32. .B rotate
  33. commands are undesirable when just viewing a graph, they are only enabled if
  34. .I gview
  35. is invoked with the
  36. .B -m
  37. option.
  38. .PP
  39. The
  40. .B -p
  41. option plots only the vertices of the polygons.
  42. .PP
  43. Clicking on a polyline with button 1 displays the coordinates and a
  44. .I t
  45. value that tells how far along the polyline.
  46. .IR (t =0
  47. at the first vertex,
  48. .IR t =1
  49. at the first vertex,
  50. .IR t =1.5
  51. halfway between the second and third vertices, etc.) The
  52. .B -l
  53. option generates a log file that lists all points selected in this manner.
  54. .PP
  55. The most important interactive operations are to
  56. .I zoom in
  57. by sweeping out a rectangle, or to
  58. .I zoom out
  59. so that everything currently being displayed shrinks to fit in the swept-out
  60. rectangle. Other options on the button 3 menu are
  61. .I unzoom
  62. which restores the coordinate system to the default state where everything
  63. fits on the screen,
  64. .I recenter
  65. which takes a point and makes it the center of the window, and
  66. .I square up
  67. which makes the horizontal and vertical scale factors equal.
  68. .PP
  69. To take a graph of a function where some part is almost linear and
  70. see how it deviates from a straight line, select two points on this
  71. part of the graph (i.e., select one with button 1 and then select the
  72. other) and then use the
  73. .I slant
  74. command on the button 3 menu.
  75. This slants the coordinate system so that the line between the two
  76. selected points appears horizontal (but vertical still means positive
  77. .IR y ).
  78. Then the
  79. .I zoom in
  80. command can be used to accentuate deviations from horizontal.
  81. There is also an
  82. .I unslant
  83. command that undoes all of this and goes back to an unslanted coordinate
  84. system.
  85. .PP
  86. There is a
  87. .I recolor
  88. command on button 3 that lets you select a color and change everything
  89. to have that color, and a similar command on button 2 that only affects
  90. the selected polyline. If the input file uses the
  91. .B Multi(...)
  92. feature explained below, either flavor of
  93. .I recolor
  94. allows you to type a digit in lieu of selecting a color.
  95. .PP
  96. The
  97. .I thick
  98. or
  99. .I thin
  100. command on button 2 changes the thickness of the selected polyline
  101. and there is also an undo command for such edits.
  102. Finally, button 3 has commands to
  103. .I read
  104. a new input file and display it on top of everything else,
  105. .I restack
  106. the drawing order (in case lines of different color are drawn on top of
  107. each other),
  108. .I write
  109. everything into an output file, or
  110. .I exit
  111. the program.
  112. .PP
  113. Each polyline in an input or output file is a space-delimited
  114. .I x
  115. .I y
  116. coordinate pair on a line by itself, and the polyline is a sequence
  117. of such vertices followed by a label. The label could be just a
  118. blank line or it could be a string in double
  119. quotes, or virtually any text that does not contain spaces and is
  120. on a line by itself. The label at the end of the last polyline is
  121. optional. It is not legal to have two consecutive labels, since that
  122. would denote a zero-vertex polyline and each polyline must have at least
  123. one vertex. (One-vertex polylines are useful for scatter plots.)
  124. Under the
  125. .B -l
  126. option, a newline causes the selected polyline's label to appear in
  127. the log file (where it could be seen by invoking
  128. .B tail -f
  129. in another window).
  130. If the label after a polyline contains the word
  131. .B "Thick"
  132. or a color name
  133. .BR (Red ,
  134. .BR Pink ,
  135. .BR Dkred ,
  136. .BR Orange ,
  137. .BR Yellow ,
  138. .BR Dkyellow ,
  139. .BR Green ,
  140. .BR Dkgreen ,
  141. .BR Cyan ,
  142. .BR Blue ,
  143. .BR Ltblue ,
  144. .BR Magenta ,
  145. .BR Violet ,
  146. .BR Gray ,
  147. .BR Black ,
  148. .BR White ),
  149. whichever color name comes first will be used to color the polyline.
  150. Alternatively, labels can contain
  151. .B Multi
  152. followed by single-letter versions of these names:
  153. .BR (R ,
  154. .BR P ,
  155. .BR r ,
  156. .BR O ,
  157. .BR Y ,
  158. .BR y ,
  159. .BR G ,
  160. .BR g ,
  161. .BR C ,
  162. .BR B ,
  163. .BR b ,
  164. .BR M ,
  165. .BR V ,
  166. .BR A ,
  167. .BR K ,
  168. .BR W ,
  169. each optionally preceded by
  170. .BR T ).
  171. Then
  172. .I recolor
  173. followed by a nonzero digit
  174. .I n
  175. selects the
  176. .IR n th
  177. alternative for each polyline.
  178. .SH EXAMPLE
  179. To see a graph of the function
  180. .IR y = sin( x )/ x ,
  181. generate input with an awk script and pipe it into
  182. .IR gview :
  183. .IP
  184. .EX
  185. awk 'BEGIN{for(x=.1;x<500;x+=.1)print x,sin(x)/x}' | gview
  186. .EE
  187. .SH SOURCE
  188. .B /sys/src/cmd/gview.c
  189. .SH SEE ALSO
  190. .IR awk (1),
  191. .IR tail (1)
  192. .SH BUGS
  193. The user interface for the
  194. .I slant
  195. command is counter-intuitive. Perhaps it would be better to have a scheme
  196. for sweeping out a parallelogram.
  197. .PP
  198. The
  199. .B -p
  200. option makes the interactive point selection feature behave strangely, and
  201. is unnecessary since extra blank lines in the input achieve essentially the
  202. same effect.