#### 3.1.1 plg ¶

Yorick’s plg command plots a one dimensional array of y values as a function of a corresponding array of x values. To be more precise,

    plg, y, x

plots a sequence of line segments from `(x(1),y(1))` to `(x(2),y(2))` to `(x(3),y(3))`, and so on until `(x(N),y(N))`, when x and y are N element arrays.

The “backwards” order of the arguments to plg (y,x instead of x,y) allows for a default value of x. Namely,

    plg, y

plots y against 1, 2, 3, ..., N, or `indgen(numberof(y))` in Yorick parlance. You often want a plot of an array y with the horizontal axis (y is plotted vertically) merely indicating the sequence of values in the array.

Optional keyword arguments adjust line type (solid, dashed, etc.), line color, markers placed along the line, whether to connect the last point to the first to make a closed polygon, whether to draw direction arrows, and other variations on the basic connect-the-dots theme.

Specifying line type 0 or "none" by means of the type= keyword causes plg to plot markers at the points themselves, rather than a polyline connecting the points. Here is how you make a “scatter plot”:

    plg, type=0, y, x

For a polymarker plot, x and y may be scalars or unit length arrays. If you need to specify your own marker shapes (perhaps to plot experimental data points), you may want to use the plmk function – use the help function to find out how.