GVIEW(1)                                                 GVIEW(1)

     NAME
          gview - interactive graph viewer

     SYNOPSIS
          gview [ -l logfile ] [ -m ] [ file ]

     DESCRIPTION
          Gview reads polygonal lines or a polygonal line drawing from
          an ASCII input file (which defaults to standard input), and
          views it interactively, with commands to zoom in and out,
          perform simple editing operations, and display information
          about points and polylines.  The editing commands can change
          the color and thickness of the polylines, delete (or
          undelete) some of them, and optionally rotate and move them.
          It is also possible to generate an output file that reflects
          these changes and is in the same format as the input.

          Since the move and rotate commands are undesirable when just
          viewing a graph, they are only enabled if gview is invoked
          with the -m option.

          Clicking on a polyline with button 1 displays the coordi-
          nates and a t value that tells how far along the polyline.
          (t=0 at the first vertex, t=1 at the first vertex, t=1.5
          halfway between the second and third vertices, etc.)  The -l
          option generates a log file that lists all points selected
          in this manner.

          The most important interactive operations are to zoom in by
          sweeping out a rectangle, or to zoom out so that everything
          currently being displayed shrinks to fit in the swept-out
          rectangle.  Other options on the button 3 menu are unzoom
          which restores the coordinate system to the default state
          where everything fits on the screen, recenter which takes a
          point and makes it the center of the window, and square up
          which makes the horizontal and vertical scale factors equal.

          To take a graph of a function where some part is almost lin-
          ear and see how it deviates from a straight line, select two
          points on this part of the graph (i.e., select one with but-
          ton 1 and then select the other) and then use the slant com-
          mand on the button 3 menu.  This slants the coordinate sys-
          tem so that the line between the two selected points appears
          horizontal (but vertical still means positive y). Then the
          zoom in command can be used to accentuate deviations from
          horizontal.  There is also an unslant command that undoes
          all of this and goes back to an unslanted coordinate system.

          There is a recolor command on button 3 that lets you select
          a color and change everything to have that color, and a

     Page 1                       Plan 9             (printed 4/18/24)

     GVIEW(1)                                                 GVIEW(1)

          similar command on button 2 that only affects the selected
          polyline.  The thick or thin command on button 2 changes the
          thickness of the selected polyline and there is also an undo
          command for such edits.

          Finally, button 3 had commands to read a new input file and
          display it on top of everything else, restack the drawing
          order (in case lines of different color are drawn on top of
          each other), write everything into an output file, or exit
          the program.

          Each polyline in an input or output file is a space-
          delimited x y coordinate pair on a line by itself, and the
          polyline is a sequence of such vertices followed by a label.
          The label could be just a blank line or it could be a string
          in double quotes, or virtually any text that does not con-
          tain spaces and is on a line by itself.  The label at the
          end of the last polyline is optional.   It is not legal to
          have two consecutive labels, since that would denote a
          zero-vertex polyline and each polyline must have at least
          one vertex. (One-vertex polylines are useful for scatter
          plots.)

          If the label after a polyline can contains the word Thick or
          a color name (Red, Pink, Dkred, Orange, Yellow, Dkyellow,
          Green, Dkgreen, Cyan, Blue, Ltblue, Magenta, Violet, Gray,
          Black, White), whichever color name comes first will be used
          to color the polyline.

     EXAMPLE
          To see a graph of the function y=sin(x)/x generate input
          with an awk script and pipe it into gview:

               awk 'BEGIN{for(x=.1;x<500;x+=.1)print x,sin(x)/x}' | gview

     SOURCE
          /usr/local/plan9/src/cmd/draw/gview.c

     SEE ALSO
          awk(1)

     BUGS
          The user interface for the slant command is counter-
          intuitive.  Perhaps it would be better to have a scheme for
          sweeping out a parallelogram.

     Page 2                       Plan 9             (printed 4/18/24)