5.23.17 key

set key [ <position> ... ] [<xoffset>, <yoffset>]

The setting ‘key’ determines whether a legend is placed on a plot, and if so, where it should be located on the plot. Issuing the command:

set key

simply causes a legend to be added to the plot in its default position, usually the plot’s upper-right corner. The converse action is achieved by:

set nokey

or:

unset key

both of which cause a plot to have no legend. A position for the key may also be specified after the set key command, for example:

set key bottom left

Recognised positions are ‘top’, ‘bottom’, ‘left’, ‘right’, ‘below’, ‘outside’, ‘xcentre’ and ‘ycentre’. In addition, if none of these quite achieved the desired result, a positional offset may be specified after one of the position keywords above. The first value is assumed to be an $x$-offset, and the second a $y$-offset, in units approximately equal to the size of the plot. For example:

set key bottom left 0.0 -0.5

would display a key below the bottom left corner of the graph.