1
0

gview 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. The
  91. .I thick
  92. or
  93. .I thin
  94. command on button 2 changes the thickness of the selected polyline
  95. and there is also an undo command for such edits.
  96. .PP
  97. Finally, button 3 has commands to
  98. .I read
  99. a new input file and display it on top of everything else,
  100. .I restack
  101. the drawing order (in case lines of different color are drawn on top of
  102. each other),
  103. .I write
  104. everything into an output file, or
  105. .I exit
  106. the program.
  107. .PP
  108. Each polyline in an input or output file is a space-delimited
  109. .I x
  110. .I y
  111. coordinate pair on a line by itself, and the polyline is a sequence
  112. of such vertices followed by a label. The label could be just a
  113. blank line or it could be a string in double
  114. quotes, or virtually any text that does not contain spaces and is
  115. on a line by itself. The label at the end of the last polyline is
  116. optional. It is not legal to have two consecutive labels, since that
  117. would denote a zero-vertex polyline and each polyline must have at least
  118. one vertex. (One-vertex polylines are useful for scatter plots.)
  119. If the label after a polyline contains the word
  120. .B "Thick"
  121. or a color name
  122. .BR (Red ,
  123. .BR Pink ,
  124. .BR Dkred ,
  125. .BR Orange ,
  126. .BR Yellow ,
  127. .BR Dkyellow ,
  128. .BR Green ,
  129. .BR Dkgreen ,
  130. .BR Cyan ,
  131. .BR Blue ,
  132. .BR Ltblue ,
  133. .BR Magenta ,
  134. .BR Violet ,
  135. .BR Gray ,
  136. .BR Black ,
  137. .BR White ),
  138. whichever color name comes first will be used to color the polyline.
  139. .SH EXAMPLE
  140. To see a graph of the function
  141. .IR y = sin( x )/ x ,
  142. generate input with an awk script and pipe it into
  143. .IR gview :
  144. .IP
  145. .EX
  146. awk 'BEGIN{for(x=.1;x<500;x+=.1)print x,sin(x)/x}' | gview
  147. .EE
  148. .SH SOURCE
  149. .B /sys/src/cmd/gview.c
  150. .SH SEE ALSO
  151. .IR awk (1)
  152. .SH BUGS
  153. The user interface for the
  154. .I slant
  155. command is counter-intuitive. Perhaps it would be better to have a scheme
  156. for sweeping out a parallelogram.