next up previous contents index
Next: Lmargin Up: Set-show Previous: Key   Contents   Index


Label

Arbitrary labels can be placed on the plot using the set label command.

Syntax:

     set label {<tag>} {"<label text>"} {at <position>}
               {left | center | right}
               {norotate | rotate {by <degrees>}}
               {font "<name>{,<size>}"}
               {noenhanced}
               {front | back}
               {textcolor <colorspec>}
               {point <pointstyle> | nopoint}
               {offset <offset>}
     unset label {<tag>}
     show label

The 5#5position6#6 is specified by either x,y or x,y,z, and may be preceded by first, second, graph, screen, or character to select the coordinate system. See coordinates (p. [*]) for details.

The tag is an integer that is used to identify the label. If no 5#5tag6#6 is given, the lowest unused tag value is assigned automatically. The tag can be used to delete or modify a specific label. To change any attribute of an existing label, use the set label command with the appropriate tag, and specify the parts of the label to be changed.

The 5#5label text6#6 can be a string constant, a string variable, or a string- valued expression. See strings (p. [*]), sprintf (p. [*]), and gprintf (p. [*]).

By default, the text is placed flush left against the point x,y,z. To adjust the way the label is positioned with respect to the point x,y,z, add the justification parameter, which may be left, right or center, indicating that the point is to be at the left, right or center of the text. Labels outside the plotted boundaries are permitted but may interfere with axis labels or other text.

If rotate is given, the label is written vertically (if the terminal can do so, of course). If rotate by 5#5degrees6#6 is given, conforming terminals will try to write the text at the specified angle; non-conforming terminals will treat this as vertical text.

Font and its size can be chosen explicitly by font "5#5name6#6{,5#5size6#6}" if the terminal supports font settings. Otherwise the default font of the terminal will be used.

Normally the enhanced text mode string interpretation, if enabled for the current terminal, is applied to all text strings including label text. The noenhanced property can be used to exempt a specific label from the enhanced text mode processing. The can be useful if the label contains underscores, for example. See enhanced text (p. [*]).

If front is given, the label is written on top of the graphed data. If back is given (the default), the label is written underneath the graphed data. Using front will prevent a label from being obscured by dense data.

Textcolor 5#5colorspec6#6 changes the color of the label text. 5#5colorspec6#6 is either a linetype or a mapping onto the pm3d color palette (available only in splot), see help for set palette (p. [*]).

  `textcolor` may be abbreviated `tc`.
  `tc default` resets the text color to its default state.
  `tc lt <n>` sets the text color to that of line type <n>.
  `tc ls <n>` sets the text color to that of line style <n>.
  `tc palette z` selects a palette color corresponding to the label z position.
  `tc palette cb <val>` selects a color corresponding to <val> on the colorbar.
  `tc palette fraction <val>`, with 0<=val<=1, selects a color corresponding to
      the mapping [0:1] to grays/colors of the `palette`.

If a 5#5pointstyle6#6 is given, using keywords lt, pt and ps, see style (p. [*]), a point with the given style and color of the given line type is plotted at the label position and the text of the label is displaced slightly. This option is used by default for placing labels in mouse enhanced terminals. Use nopoint to turn off the drawing of a point near the label (this is the default).

The displacement defaults to 1,1 in pointsize units if a 5#5pointstyle6#6 is given, 0,0 if no 5#5pointstyle6#6 is given. The displacement can be controlled by the optional offset 5#5offset6#6 where 5#5offset6#6 is specified by either x,y or x,y,z, and may be preceded by first, second, graph, screen, or character to select the coordinate system. See coordinates (p. [*]) for details.

If one (or more) axis is timeseries, the appropriate coordinate should be given as a quoted time string according to the timefmt format string. See set xdata (p. [*]) and set timefmt (p. [*]).

The EEPIC, Imagen, LaTeX, and TPIC drivers allow 3#33#3 in a string to specify a newline.

Examples:

To set a label at (1,2) to "y=x", use:

     set label "y=x" at 1,2

To set a Sigma of size 24, from the Symbol font set, at the center of the graph, use:

     set label "S" at graph 0.5,0.5 center font "Symbol,24"

To set a label "y=x^2" with the right of the text at (2,3,4), and tag the label as number 3, use:

     set label 3 "y=x^2" at 2,3,4 right

To change the preceding label to center justification, use:

     set label 3 center

To delete label number 2, use:

     unset label 2

To delete all labels, use:

     unset label

To show all labels (in tag order), use:

     show label

To set a label on a graph with a timeseries on the x axis, use, for example:

     set timefmt "%d/%m/%y,%H:%M"
     set label "Harvest" at "25/8/93",1

To display a freshly fitted parameter on the plot with the data and the fitted function, do this after the fit, but before the plot:

     set label sprintf("a = %3.5g",par_a) at 30,15
     bfit = gprintf("b = %s*10^%S",par_b)
     set label bfit at 30,20

To set a label displaced a little bit from a small point:

     set label 'origin' at 0,0 point lt 1 pt 2 ps 3 offset 1,-1

To set a label whose color matches the z value (in this case 5.5) of some point on a 3D splot colored using pm3d:

     set label 'text' at 0,0,5.5 tc palette z


next up previous contents index
Next: Lmargin Up: Set-show Previous: Key   Contents   Index
Ethan Merritt 2007-03-03