#### 3.6.1 Legends ¶

Every plotting primitive function accepts a legend= keyword to allow you to set a legend string describing that object. If you do not supply a legend= keyword, Yorick supplies a default by repeating a portion of the command line. For example,

    plg, cos(x), x

will have the default legend `"A: plg, cos(x), x"`, assuming that the curve marker for this curve is `"A"`. You can specify a more descriptive legend with the `legend=` keyword:

    plg, cos(x), x, legend="oscillating driving force"

If you want the legend to have the curve marker prepended, so it is `"A: oscillating driving force"` if the curve marker is `"A"`, but `"F: oscillating driving force"` if the curve marker is `"F"`, you can begin the legend string with the special character `"\1"`:

    plg, cos(x), x, legend="\1: oscillating driving force"

Like legends, you can specify a curve marker letter with the marker= keyword, but if you don’t, Yorick picks a value based on how many curves have been plotted. By default, Yorick draws the marker letter on top of the curve every once in a while – so A’s mark curve A, B’s mark curve B, and so on. This is only relevant for the plg and plc commands. This default style is ugly; use it for working plots, not polished graphics. You should turn the markers off by means of the `marks=0` keyword for high quality plots, and distinguish your curves by line type. For example,

    plg, cos(x), x, marks=0, type="dash",
      legend="oscillating driving force (dash)"

In order to conserve screen space, legends never appear on your screen; they only appear in hardcopy files. Furthermore, depending on the graphics style, legends may not appear in hardcopy either. In particular, the `vg.gs` and `nobox.gs` styles have no legends. This is because legends are ugly. Legends take the place of a proper figure caption in working plots. For high quality output, I expect you to take the trouble to add a proper caption. You can use the `legends=0` keyword to the window command in order to eliminate the legends even from those graphics styles where they normally appear.