gview 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. .TH GVIEW 1
  2. .SH NAME
  3. gview \- interactive graph viewer
  4. .SH SYNOPSIS
  5. .B gview
  6. [
  7. .B -l
  8. .I logfile
  9. ]
  10. [
  11. .B -m
  12. ]
  13. [
  14. .I file
  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. The editing commands can
  23. change the color and thickness of the polylines, delete (or undelete)
  24. some of them, and optionally rotate and move them. It is also possible to
  25. generate an output file that reflects these changes and is in the same format
  26. as the input.
  27. .PP
  28. Since the
  29. .B move
  30. and
  31. .B rotate
  32. commands are undesirable when just viewing a graph, they are only enabled if
  33. .I gview
  34. is invoked with the
  35. .B -m
  36. option.
  37. .PP
  38. Clicking on a polyline with button 1 displays the coordinates and a
  39. .I t
  40. value that tells how far along the polyline.
  41. .IR (t =0
  42. at the first vertex,
  43. .IR t =1
  44. at the first vertex,
  45. .IR t =1.5
  46. halfway between the second and third vertices, etc.) The
  47. .B -l
  48. option generates a log file that lists all points selected in this manner.
  49. .PP
  50. The most important interactive operations are to
  51. .I zoom in
  52. by sweeping out a rectangle, or to
  53. .I zoom out
  54. so that everything currently being displayed shrinks to fit in the swept-out
  55. rectangle. Other options on the button 3 menu are
  56. .I unzoom
  57. which restores the coordinate system to the default state where everything
  58. fits on the screen,
  59. .I recenter
  60. which takes a point and makes it the center of the window, and
  61. .I square up
  62. which makes the horizontal and vertical scale factors equal.
  63. .PP
  64. To take a graph of a function where some part is almost linear and
  65. see how it deviates from a straight line, select two points on this
  66. part of the graph (i.e., select one with button 1 and then select the
  67. other) and then use the
  68. .I slant
  69. command on the button 3 menu.
  70. This slants the coordinate system so that the line between the two
  71. selected points appears horizontal (but vertical still means positive
  72. .IR y ).
  73. Then the
  74. .I zoom in
  75. command can be used to accentuate deviations from horizontal.
  76. There is also an
  77. .I unslant
  78. command that undoes all of this and goes back to an unslanted coordinate
  79. system.
  80. .PP
  81. There is a
  82. .I recolor
  83. command on button 3 that lets you select a color and change everything
  84. to have that color, and a similar command on button 2 that only affects
  85. the selected polyline. The
  86. .I thick
  87. or
  88. .I thin
  89. command on button 2 changes the thickness of the selected polyline
  90. and there is also an undo command for such edits.
  91. .PP
  92. Finally, button 3 had commands to
  93. .I read
  94. a new input file and display it on top of everything else,
  95. .I restack
  96. the drawing order (in case lines of different color are drawn on top of
  97. each other),
  98. .I write
  99. everything into an output file, or
  100. .I exit
  101. the program.
  102. .PP
  103. Each polyline in an input or output file is a space-delimited
  104. .I x
  105. .I y
  106. coordinate pair on a line by itself, and the polyline is a sequence
  107. of such vertices followed by a label. The label could be just a
  108. blank line or it could be a string in double
  109. quotes, or virtually any text that does not contain spaces and is
  110. on a line by itself. The label at the end of the last polyline is
  111. optional. It is not legal to have two consecutive labels, since that
  112. would denote a zero-vertex polyline and each polyline must have at least
  113. one vertex. (One-vertex polylines are useful for scatter plots.)
  114. If the label after a polyline can contains the word
  115. .B "Thick"
  116. or a color name
  117. .BR (Red ,
  118. .BR Pink ,
  119. .BR Dkred ,
  120. .BR Orange ,
  121. .BR Yellow ,
  122. .BR Dkyellow ,
  123. .BR Green ,
  124. .BR Dkgreen ,
  125. .BR Cyan ,
  126. .BR Blue ,
  127. .BR Ltblue ,
  128. .BR Magenta ,
  129. .BR Violet ,
  130. .BR Gray ,
  131. .BR Black ,
  132. .BR White ),
  133. whichever color name comes first will be used to color the polyline.
  134. .SH EXAMPLE
  135. To see a graph of the function
  136. .IR y = sin( x )/ x ,
  137. generate input with an awk script and pipe it into
  138. .IR gview :
  139. .IP
  140. .EX
  141. awk 'BEGIN{for(x=.1;x<500;x+=.1)print x,sin(x)/x}' | gview
  142. .EE
  143. .SH SOURCE
  144. .B /sys/src/cmd/gview.c
  145. .SH SEE ALSO
  146. .IR awk (1)
  147. .SH BUGS
  148. The user interface for the
  149. .I slant
  150. command is counter-intuitive. Perhaps it would be better to have a scheme
  151. for sweeping out a parallelogram.