Credits Overview Plotting Styles Commands Terminals

key

The set key command enables a key (or legend) containing a title and a sample (line, point, box) for each plot in the graph. The key may be turned off by requesting set key off or unset key. Individual key entries may be turned off by using the notitle keyword in the corresponding plot command. The text of the titles is controlled by the set key autotitle option or by the title keyword of individual plot and splot commands. Many options are available to control the placement and layout of the key.

Syntax:

      set key {on|off} {default}
            {{no}enhanced}
            {{no}autotitle {columnheader}}
            {{no}box {<line properties>}} {{no}opaque {fc <colorspec>}}
            {width <width_increment>} {height <height_increment>}
            {offset <dx>,<dy>}
      unset key

By default the key is placed in the upper right inside corner of the graph. For placement options, see key placement.

Each component in a plot command is represented in the key by a single line containing corresponding title text and a line or symbol or shape representing the plot style. The title text may be auto-generated or given explicitly in the plot command as title "text". Using the keyword notitle in the plot command will suppress generation of the entire line. If you want to suppress the text only, use title "" in the plot command. Contour plots generated additional entries in the key (see cntrlabel). You can add extra lines to the key by inserting a dummy plot command that uses the keyword keyentry rather than a filename or a function. See keyentry. For options to customize the layout of the titles and samples in the key see key layout.

A box can be drawn around the key (box {...}) with user-specified line properties. The height and width increments (specified in character units) are added to or subtracted from the size of the key box. This is useful mainly when you want larger borders around the key entries.

By default the key is built up one plot at a time. That is, the key symbol and title are drawn at the same time as the corresponding plot. That means newer plots may sometimes place elements on top of the key. set key opaque causes the key to be generated after all the plots. In this case the key area is filled with background color or the requested fill color and then the key symbols and titles are written. The default can be restored by set key noopaque.

The text in the key uses enhanced mode by default. This can be suppressed by the noenhanced keyword applied to the entire key, to the key title only, or to individual plot titles.

set key default restores the default key configuration.

     set key fixed right top vertical Right noreverse enhanced autotitle
     set key nobox noopaque
     set key noinvert samplen 4 spacing 1 width 0 height 0 
Subtopics