Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 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
 
131
If the label after a polyline contains the word
132
.B "Thick"
133
or a color name
134
.BR (Red ,
135
.BR Pink ,
136
.BR Dkred ,
137
.BR Orange ,
138
.BR Yellow ,
139
.BR Dkyellow ,
140
.BR Green ,
141
.BR Dkgreen ,
142
.BR Cyan ,
143
.BR Blue ,
144
.BR Ltblue ,
145
.BR Magenta ,
146
.BR Violet ,
147
.BR Gray ,
148
.BR Black ,
149
.BR White ),
150
whichever color name comes first will be used to color the polyline.
151
Alternatively, labels can contain
152
.B Multi
153
followed by single-letter versions of these names:
154
.BR (R ,
155
.BR P ,
156
.BR r ,
157
.BR O ,
158
.BR Y ,
159
.BR y ,
160
.BR G ,
161
.BR g ,
162
.BR C ,
163
.BR B ,
164
.BR b ,
165
.BR M ,
166
.BR V ,
167
.BR A ,
168
.BR K ,
169
.BR W ,
170
each optionally preceded by
171
.BR T ).
172
Then
173
.I recolor
174
followed by a nonzero digit
175
.I n
176
selects the
177
.IR n th
178
alternative for each polyline.
179
 
180
.SH EXAMPLE
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
184
.IR gview :
185
.IP
186
.EX
187
awk 'BEGIN{for(x=.1;x<500;x+=.1)print x,sin(x)/x}' | gview
188
.EE
189
.SH SOURCE
190
.B /sys/src/cmd/gview.c
191
.SH SEE ALSO
192
.IR awk (1),
193
.IR tail (1)
194
.SH BUGS
195
The user interface for the
196
.I slant
197
command is counter-intuitive.  Perhaps it would be better to have a scheme
198
for sweeping out a parallelogram.
199
.PP
200
The
201
.B -p
202
option makes the interactive point selection feature behave strangely, and
203
is unnecessary since extra blank lines in the input achieve essentially the
204
same effect.