Credits | Overview | Plotting Styles | Commands | Terminals |
---|
Key layout options:
set key {vertical | horizontal} {maxcols {<max no. of columns> | auto}} {maxrows {<max no. of rows> | auto}} {columns <exact no. of columns>} {keywidth [screen|graph] <fraction>} {Left | Right} {{no}reverse} {{no}invert} {samplen <sample_length>} {spacing <line_spacing>} {width <width_increment>} {height <height_increment>} {title {"<text>"} {{no}enhanced} {center | left | right}} {font "<face>,<size>"} {textcolor <colorspec>}
Automatic arrangement of elements within the key into rows and columns is affected by the keywords shown above. The default is vertical, for which the key uses the fewest columns possible. Elements are aligned in a column until there is no more vertical space, at which point a new column is started. The vertical space may be limited using 'maxrows'. In the case of horizontal, the key instead uses the fewest rows possible. The horizontal space may be limited using 'maxcols'.
The auto-selected number of rows and columns may be unsatisfactory. You can specify a definite number of columns using set key columns <N>. In this case you may need to adjust the sample widths (samplen) and the total key width (keywidth).
By default the first plot label is at the top of the key and successive labels are entered below it. The invert option causes the first label to be placed at the bottom of the key, with successive labels entered above it. This option is useful to force the vertical ordering of labels in the key to match the order of box types in a stacked histogram.
set key title "text" places an overall title at the top of the key. Font, text justification, and other text properties specific to the title can be specified by placing the required keywords immediately after the "text" in this command. Font or text properties specified elsewhere apply to all text in the key.
The default layout places a style sample (color, line, point, shape, etc) at the left of the key entry line, and the title text at the right. The text and sample positions can be swapped using the reverse keyword. Text justification of the individual plot titles within the key is controlled by Left or Right (default). The horizontal extend of the style sample can be set to an approximate number of character width (samplen).
When using the TeX/LaTeX group of terminals or terminals in which formatting information is embedded in the string, gnuplot is bad at estimating the amount of space required, so the automatic key layout may be poor. If the key is to be positioned at the left, it may help to use the combination set key left Left reverse and force the appropriate number of columns or total key width.