Text labels may be placed on plots using the set label command. As with all textual labels in PyXPlot, these are rendered in LaTeX:
set label 1 'Hello World' at 0,0
As in the previous section, the number 1 is a reference number, which allows the label to be removed by either of the following two commands:
set nolabel 1 unset label 1
The positional co-ordinates for the text label, placed after the at keyword, can be specified in any of the co-ordinate systems described for arrows above. A rotation angle may optionally be specified after the keyword rotate, to rotate text counter-clockwise by a given angle, measured in degrees. For example, the following would produce upward-running text:
set label 1 'Hello World' at axis3 3.0, axis4 2.7 rotate 90
A colour can also be specified, if desired, using the with colour modifier. For example, the following would produce a green label at the origin:
set label 2 'This label is green' at 0, 0 with colour green
The fontsize of these text labels can be set globally using the set fontsize command. This applies not only to the set label command, but also to plot titles, axis labels, keys, etc. The value given should be an integer in the range . The default is zero, which corresponds to LaTeX’s normalsize;
corresponds to tiny and 5 to Huge.
The set textcolour command can be used to globally set the colour of all text output, and applies to all of the text that the set fontsize command does. It is especially useful when producing plots to be embedded in presentation slideshows, where bright text on a dark background may be desired. It should be followed either by an integer, to set a colour from the present palette, or by a colour name. A list of the recognised colour names can be found in Section 7.6. For example:
set textcolour 2 set textcolour blue
By default, each label’s specified position corresponds to its bottom left corner. This alignment may be changed with the set texthalign and set textvalign commands. The former takes the options left, centre or right, and the latter takes the options bottom, centre or top, for example:
set texthalign right set textvalign top
An example of a somewhat unconventional plot containing many labels and lines can be found in Figure 5.1.