3 gview \- interactive graph viewer
18 reads polygonal lines or a polygonal line drawing from an
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
33 commands are undesirable when just viewing a graph, they are only enabled if
41 option plots only the vertices of the polygons.
43 Clicking on a polyline with button 1 displays the coordinates and a
45 value that tells how far along the polyline.
51 halfway between the second and third vertices, etc.) The
53 option generates a log file that lists all points selected in this manner.
55 The most important interactive operations are to
57 by sweeping out a rectangle, or to
59 so that everything currently being displayed shrinks to fit in the swept-out
60 rectangle. Other options on the button 3 menu are
62 which restores the coordinate system to the default state where everything
65 which takes a point and makes it the center of the window, and
67 which makes the horizontal and vertical scale factors equal.
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
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
80 command can be used to accentuate deviations from horizontal.
83 command that undoes all of this and goes back to an unslanted coordinate
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
92 feature explained below, either flavor of
94 allows you to type a digit in lieu of selecting a color.
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
104 a new input file and display it on top of everything else,
106 the drawing order (in case lines of different color are drawn on top of
109 everything into an output file, or
113 Each polyline in an input or output file is a space-delimited
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.)
126 option, a newline causes the selected polyline's label to appear in
127 the log file (where it could be seen by invoking
131 If the label after a polyline contains the word
150 whichever color name comes first will be used to color the polyline.
151 Alternatively, labels can contain
153 followed by single-letter versions of these names:
170 each optionally preceded by
174 followed by a nonzero digit
178 alternative for each polyline.
181 To see a graph of the function
182 .IR y = sin( x )/ x ,
183 generate input with an awk script and pipe it into
187 awk 'BEGIN{for(x=.1;x<500;x+=.1)print x,sin(x)/x}' | gview
190 .B /sys/src/cmd/gview.c
195 The user interface for the
197 command is counter-intuitive. Perhaps it would be better to have a scheme
198 for sweeping out a parallelogram.
202 option makes the interactive point selection feature behave strangely, and
203 is unnecessary since extra blank lines in the input achieve essentially the