GVIEW(1)

✨ NAME ✨

gview β€” interactive graph viewer. That's the whole vibe, bestie πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

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

πŸ’– DESCRIPTION πŸ’–

okay so gview reads polygonal lines or a polygonal line drawing from an ASCII input file β€” and yes, that input file defaults to standard input β€” then views it interactively. It's got commands to zoom in and out, do simple editing operations, and display info 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's also possible to generate an output file that reflects these changes and is in the same format as the input. slay ✨

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

  • -l logfile β€” generates a log file that lists all points selected in this manner.
  • -m β€” enables the move and rotate commands.
  • file β€” the input file; defaults to standard input.

Clicking on a polyline with button 1 displays the coordinates and a t value that tells how far along the polyline. The page literally says t=0 at the first vertex, t=1 at the first vertex, t=1.5 halfway between the second and third vertices, etc. β€” yes, both, I'm not fixing the lore 😭. 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. iconic behavior honestly πŸ‘‘

To take a graph of a function where some part is almost linear and see how it deviates from a straight line, select two points on this part of the graph (i.e., select one with button 1 and then select the other) and then use the slant command on the button 3 menu. This slants the coordinate system 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. no cap, that's the whole trick πŸ¦‹

There is a recolor command on button 3 that lets you select a color and change everything to have that color, and a 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. cute AND functional πŸ’…

Finally, button 3 has 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
  • 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 contain 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 contain 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. iykyk 🌈

🌈 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 πŸ‘‘

/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. not me calling out the UI design 😭


That's a wrap on GVIEW(1) from the General Commands Manual β€” source file is /src/cmd/draw/gview.c, and the footer is just GVIEW(1) with no version or date listed. bestie, you're officially caught up πŸ«ΆπŸŽ€