Labels can be applied to the two axes of the plot, and a title put at the top:
set xlabel 'This is the X axis' set ylabel 'This is the Y axis' set title 'A plot of sin(x)' plot sin(x)
The output from this simple example is shown in Figure 2.1. All such text labels should be placed between either single (’) or double (") quotes. They are displayed using LaTeX, and so any LaTeX commands can be used, for example to put equations on axes:
set xlabel '$\frac{x^2}{c^2}$'
As a caveat, however, this does mean that care needs to be taken to escape any of LaTeX’s reserved characters – i.e.: & % # { } $ _
or
.
Because of the use of quotes to delimit text labels, special care needs to be taken when apostrophe and quote characters are used. The following command would raise an error, because the apostrophe would be interpretted as marking the end of the text label:
set xlabel 'My plot's X axis'
The following would achieve the desired effect:
set xlabel "My plot's X axis"
To allow one to render LaTeX strings containing both single and double quote characters – for example, to put a German umlaut on the name “Jörg” in the LaTeX string “J"org’s Data” – PyXPlot recognises the backslash character to be an escape character when followed by either ’ or " in a LaTeX string. This is the only case in which PyXPlot considers
an escape character. To render the example string above, one would type:
set xlabel "J\\"org's Data"
Two backslashes are used. The first backslash is the LaTeX escape character used to produce the umlaut; the second is a PyXPlot escape character, used so that the " character is not interpretted as delimiting the string.
Having set labels and titles, they may be removed thus:
set xlabel '' set ylabel '' set title ''
These are two other ways of removing the title from a plot:
set notitle unset title
The unset command may be followed by essentially any word that can follow the set command, such as xlabel or title, to return that setting to its default configuration. The reset command restores all configurable parameters to their default states.