Blob


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.)
115 If the label after a polyline can contains the word
116 .B "Thick"
117 or a color name
118 .BR (Red ,
119 .BR Pink ,
120 .BR Dkred ,
121 .BR Orange ,
122 .BR Yellow ,
123 .BR Dkyellow ,
124 .BR Green ,
125 .BR Dkgreen ,
126 .BR Cyan ,
127 .BR Blue ,
128 .BR Ltblue ,
129 .BR Magenta ,
130 .BR Violet ,
131 .BR Gray ,
132 .BR Black ,
133 .BR White ),
134 whichever color name comes first will be used to color the polyline.
135 .SH EXAMPLE
136 To see a graph of the function
137 .IR y = sin( x )/ x ,
138 generate input with an awk script and pipe it into
139 .IR gview :
140 .IP
141 .EX
142 awk 'BEGIN{for(x=.1;x<500;x+=.1)print x,sin(x)/x}' | gview
143 .EE
144 .SH SOURCE
145 .B \*9/src/cmd/draw/gview.c
146 .SH SEE ALSO
147 .MR awk (1)
148 .SH BUGS
149 The user interface for the
150 .I slant
151 command is counter-intuitive. Perhaps it would be better to have a scheme
152 for sweeping out a parallelogram.