8.27.21 label

set label <label number> '<text>' [<co-ordinate>] <x>,
                                  [<co-ordinate>] <y>
                                  [rotate <angle>]
                                  [with colour <colour>]
<co-ordinate> = ( first | second | screen | graph |
                  axis<axisnumber>                  )

The set label command can be used to place text labels onto a plot. For example:

set label 1 'Hello' 0, 0

would place the word ‘Hello’ at plot co-ordinates $(0,0)$, as measured on the $x$- and $y$-axes. The tag 1 immediately following the label keyword is an identification number, and allows the label to be removed later with the unset label command. By default the position co-ordinates of the label are measured relative to the first $x$- and $y$-axes, but can be specified in a range of co-ordinate systems. These are specified as follows:

set label 1 'Hello' first 0, second 0

As can be seen, the name of the desired co-ordinate system precedes the position value in that co-ordinate system. Following Gnuplot’s nomenclature, the co-ordinate system first the default, measures the graph using the $x$- and $y$-axes. second uses the $x2$- and $y2$-axes. screen and graph both measure in centimetres from the origin of the graph. The syntax axisn may also be used, to use the $n$ th $x$- or $y$-axis; for example, axis3:

set label 1 'Hello' axis3 1, axis4 1

A rotation angle may optionally be specified after the keyword rotate to produce text rotated to any arbitrary angle, measured in degrees counter-clockwise. The following example would produce upward-running text:

set label 1 'Hello' 1.2, 2.5 rotate 90

By default the labels are black; however, an arbitrary colour may be specified using the with colour modifier. For example:

set label 3 'A purple label' 0, 0 with colour purple

will place a purple label at the origin.